python-restx / flask-restx

Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask
https://flask-restx.readthedocs.io/en/latest/
Other
2.15k stars 333 forks source link

How to enable version switcher? #129

Open rqiu25 opened 4 years ago

rqiu25 commented 4 years ago

Hi team, I go through the doc but I didn't find a way to enable the version switcher in swagger, what I want to achieve is to present different swagger.json based on the version. I've already used namespace for the API: foo/v1/bar foo/v1.1/bar but the json contains the whole API v1 and v1.1, and it's kind of messy. Thanks in advance

villqrd commented 4 years ago

Hey, have you found a solution for this?

rqiu25 commented 4 years ago

Yes, I was able to provide two different swagger.json under two different versions by using blueprints: you define the different api version in two different blueprints than register them in the root Flask object instance.