flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

Context Values: Engine V7 compatibility — API docs

Open khvn26 opened this issue 3 months ago • 0 comments

In order to support transition from Pydantic, we need to decouple the SDKEnvironmentAPIView response schema from the former Pydantic model, keeping the schema intact:

  1. Implement a static schema extracted from https://api.flagsmith.com/api/v1/docs/#/api/api_v1_environment-document_list.

  2. Add a schema test based on openapi-core like this:

from openapi_core import OpenAPI


def test_environment_document_schema(sdk_client: APIClient, environment: Environment) -> None:
	openapi = OpenAPI.from_file_path('../sdk/environment-document.json')
	url = reverse("api-v1:environment-document")
	request = sdk_client.get(url)

	# raises an error if the request is invalid
	result = openapi.unmarshal_request(request)

	# not sure what we can assert here but the above line will 
	# error if the schema  is invalid. 
	assert result, "THIS IS MEANT TO BE FROZEN, YOU DONUT"

khvn26 avatar Nov 28 '25 11:11 khvn26