Schema generation for Versioned API (UrlPathVersioning) #8342
Unanswered
jd-dev-pneu
asked this question in
Question & Answer
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a versioned API that is using UrlPathVersioning. When I try to generate an openapi schema spec for it using the 'generateschema' management command, the spec is generated but the version part of the spec is not filled out,
so the spec displays the route as,
/api/{version}/healthcheck
I would rather it be a specified version, for example,
/api/v2/healthcheck
Is there a way to pass this information to generateschema or customize the schema generation such that the routes in the spec contain the version in the URL? I know this can be done using drf-spectacular, but wasn't sure if it could be specified/set in django-rest-framework.
drf-spectacular does it by passing the versioning class into the as_view(), for example,
SpectacularAPIView.as_view(versioning_class=URLPathVersioning)
Beta Was this translation helpful? Give feedback.
All reactions