Closed OlegZv closed 11 months ago
The versionize
function returns the list of all versions. So you could probably just loop over those and, for each, add a /v{version}/swagger
route to the root FastAPI app manually. The swagger route would basically just call your get_docs
function like how we do it here
There is also a callback
param you could utilize, but you'd add the route to your root FastAPI app (not the versioned app passed to the callback function).
The
versionize
function returns the list of all versions. So you could probably just loop over those and, for each, add a/v{version}/swagger
route to the root FastAPI app manually. The swagger route would basically just call yourget_docs
function like how we do it here
This worked perfectly, thank you!
Subject of the issue
First of all, thank you for the great package! Just starting to experiment with it and have a question. How would I go about having separate
/swagger
and actualapi
routes? I think the example would be easiest to describe what I'm trying to achieveYour environment
Steps to reproduce
Desired behaviour
/{version}/swagger
to open the documentation based on the/{version}/openapi.json
. For example:/latest/swagger
(with/latest/openapi.json
) And API call to be prefixed with/api/{version}
. From the example above, I'd like to have/api/v1.0/version
return"latest_version"
Actual behaviour
Doesn't look like there's a way to provide a separate swagger and api paths. If I change the
prefix_format
to/api/v{major}.{minor}
then API paths are as expected, but/swagger
path is/api/{version}/swagger
.P.S. After writing this out, I'm thinking to myself "what is wrong with `/api/{version}/swagger?". Still curious if there is a way to do something like described. Thank you!