-
Notifications
You must be signed in to change notification settings - Fork 270
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
Versioning support making up non-existent versioned url #1327
Comments
Note: this also happens when defining the url in |
Hey, so on first sight this looks pretty good. Everything seems setup properly. FYI we do fully support this. Tests are here: https://github.com/tfranzel/drf-spectacular/blob/master/tests/test_versioning.py DEFAULT_VERSIONING_CLASS looks good and should be used everywhere including spectacular. Can you step into the the debugger and see if the version on any view actually parses correctly? wait a sec.. i think it is expected that the
without versioning enabled, everything is shown. that okay afais |
Thank you for the quick reply! Just to make sure we're on the same page, what I'm expecting is for the config view to only be present in the v4 schema and not in the v3 schema. Even without versioning enabled on the view, from my previous comment, it appears in both schemas. Let me know if I can help you with more information! |
Yes, that makes sense. My statement earlier was a bit imprecise. You are correct and I kind of missed this aspect. We support 4 different versioning classes and the concept of route filtering based on "populated" params apparently only makes sense for This likely needs to be handled individually in the generator. |
Sounds good! I guess this can then be marked as a bug? Let me know if I can be of further help. Thanks again for the prompt replies, much appreciated as always! |
Introduction
The
urls.py
file for one of my apps, let's call it foo, looks (somewhat) like this:And the
urls.py
file for my Django project looks like this:As you can see from the code snippet, all endpoints of the foo app support versioning (either v3 or v4), except for one endpoint (config) which was introduced in the v4 API and only supports the v4 version.
Here's a screenshot of the foo app's urls via Django's URLs in DEBUG mode:
The bug
For some reason, the
schema-v3
endpoint includes a/v3/config/
path which is not supposed to be there and obviously results in a 404 when trying it out via Swagger UI. Theschema-v4
endpoint correctly includes the/v4/config/
path.Expected behavior
The
schema-v3
endpoint doesn't include a/v3/config/
path.Additional information
settings.py
core/openapi.py
The text was updated successfully, but these errors were encountered: