-
Notifications
You must be signed in to change notification settings - Fork 13
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] Use Swagger servers
for version prefix and leave the paths as is
#44
Comments
servers
for version prefix and leave the paths as isservers
for version prefix and leave the paths as is
Something like this: OlegZv#1 |
I guess this is nice because you don't get the redundant version prefix for every route in Swagger. I think this can also be done by setting But what is the difference between setting prefix in the |
this was the default behavior in 1.0.x releases, i just noticed this because i was updating dependencies, and now 3.0.x is including the route prefix on all endpoints, which is a major bummer. |
I went with this new implementation of not using mounted sub-apps because it simplified a lot of things and allowed for more features. I felt it was worth the trade-off of showing redundant version prefixes by default. Like I said, if you want the old look of versioned Swagger pages (i.e. a server dropdown and routes without version prefixes), you could probably do something like this (although I have not tried):
|
Subject of the issue
I am trying to figure out how to make Swagger display the version prefix, like
/api/latest
in theservers
list, and the API route excludes that prefix. This way, the swagger UI paths contain only the base paths. So my two questions are:Your environment
Steps to reproduce
Running custom docs example from here: https://github.com/alexschimpf/fastapi-versionizer/blob/main/examples/docs_customization.py
Desired behavior
I'd love to get this as a result. The server contains
/v1_0
, and all the paths are "base."I achieved this by changing the
_build_version_router
torouter = APIRouter()
(no prefix) and in theversionize
changedself._app.include_router(router=version_router, prefix=version_prefix)
.Actual behavior
Each version path repeatedly starts with the version prefix
/v1_0
The text was updated successfully, but these errors were encountered: