-
Notifications
You must be signed in to change notification settings - Fork 338
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
Disable swagger.json (by config) #116
Comments
not so clear, but I tested to config the link to |
That seems rather pokish. A clean way to separately disable specs and docs via init_app() argument and configuration setting would be preferable. |
+1 for merging an option to disable |
i believe it is already there, right? sample: from flask_restx import Api
api = Api()
api.init_app(<blueprint-or-app>, add_specs=False) |
You are correct. Note to future readers. When using blueprints, per the docs at the link below, Api(app) is used instead of It turns out there's alternative way to use Restx with blueprints (which is not included in the documentation). You can pass the blueprint (instead of app) directly to init_app like so: api.init_app(blueprint). Here's the solution that also gives you access to the
Not documented here but should be: |
You can disable the UI via the optional Source: https://flask-restplus.readthedocs.io/en/0.8.2/swaggerui.html |
Although |
|
Yikes! That is good to know. Maybe it should get documented... So the proper way to completely hide the swagger APIs is to:
|
Refering to noirbizarre/flask-restplus#464
Are there any plans to merge noirbizarre/flask-restplus#465 ?
It would be awesome if it could be disabled by app config as well, since that seems to be the way most apps differ between development and production.
Maybe how flask-apispec does it would be a good way:
RESTX_SWAGGER_URL
andRESTX_SWAGGER_UI_URL
to define the routes. When set toNone
, the corresponding component is disabled.The text was updated successfully, but these errors were encountered: