Skip to content

Context Values: Engine V7 compatibility — API docs #6341

@khvn26

Description

@khvn26

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions