Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question/Request: Is it possible to maintain several API versions? #303

Closed
alienalien13 opened this issue Feb 17, 2021 · 2 comments
Closed

Comments

@alienalien13
Copy link

Now seems the hands are tied with global SPECTACULAR_SETTINGS['VERSION'].

I am using URLPathVersioning, would be great if SpectacularSwaggerView and SpectacularAPIView accept an explicit version kwarg or can deal with with version argument as it is defined by DRF https://www.django-rest-framework.org/api-guide/versioning/#urlpathversioning.

@tfranzel
Copy link
Owner

i think i understand the confusion. currently, the SPECTACULAR_SETTINGS['VERSION'] is completely independent from what you do with DRF versioning, and we do support urlpath versioning. its just a plain string in the schema.

the DRF version can be influence by either the request or by manually overriding it with: SpectacularAPIView.as_view(api_version='v2'). you will notice the VERSION string in the schema will remain the same, even though the schema changes.

i think of DRF versioning as a scoped version of a larger schema. like so:

VERSION: 1.0.1 (manually kept version)
API_VERSION: v1/v2/v3 (path versioning for example)

1.0.1 (v1)
1.0.1 (v2)
1.0.1 (v3)

this is how i view it currently, but the schema just shows 1.0.1 at the moment.

@tfranzel
Copy link
Owner

provided more options for forming the version string. documentation updated. feel free to comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants