Skip to content

OpenAPI schema is broken #6183

@khvn26

Description

@khvn26

Trying to generate an OpenAPI client from current schema results in errors:

Image

This is due to drf-yasg usage, which does not support OAS 3.0. We need OAS 3.0 to properly express union types via anyOf.

In order to support OAS 3.0, we need to migrate our OpenAPI/Swagger generation to drf-spectacular.

  • Replace drf-yasg dependency with drf-spectacular.
  • Adapt api.openapi.PydanticResponseCapableSwaggerAutoSchema.
  • Remove custom Meta and other means that produce the bespoke "type" union schema fields.
  • Make sure the /api/v1/docs/?format=openapi provides the same output, but the union types are correctly expressed with anyOf.
  • Make sure that the new schema is consumable by an OpenAPI code generator, e.g., @rtk-query/codegen-openapi.

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