Open ghost opened 1 year ago
Flask-restx was written before Flask >2.0.0 introduced nested blueprints and therefore the Api
class makes assumptions about the URLs and endpoints inside a Blueprint. I can't see any easy work around either.
Can I ask why you are interested in using nested blueprints rather than just registering another top level blueprint or using namespaces?
I'm interested in using nested blueprints since it seemed like the easiest way (mostly easy to register, as well as easy to add a redirect from /api
to the latest API version).
As for namespaces, i am using them already to register various things to api_v1, but i don't really see how i could use it to have multiple different versions on the API with different prefix.
But if there isn't an easy way to fix it to work with nested blueprints, i'll follow your suggestion and use multiple top-level blueprints instead
I meet this problem today. It would be an useful change to support nested blueprint for me. The problem I meet is:
web
to set this prefix;api
to a api blueprint first so that it won't depend on the outer blueprint web
or the app
. Thus I could decide the prefixes of all sub-blueprints together at web.register_blueprint
.Thanks for consideration!
Code
Repro Steps (if applicable)
/api/v1
pageExpected Behavior
The interactive swagger documentation for api_v1 is shown
Actual Behavior
The exception
Could not build url for endpoint 'api_v1.specs'. Did you mean 'api.api_v1.specs' instead?
is raisedError Messages/Stack Trace
Environment
Additional Context
This is the code used to define api_v1