Improve Swagger UI Config Support
https://github.com/python-restx/flask-restx/pull/14#issuecomment-575570447
A general solution to configuring Swagger UI JavaScript options will eliminate the need for adding in one off Flask config options whenevr a user requests them.
TODO: Further details and document current ideas. This is mainly here as a placeholder so the issue doesn't get lost.
Hello, following up the discussion on #100. What do you think about the following solution.
Firstly, we have SWAGGER_UI_OPTIONS in config whic is a dict object. The keys of the dict have to be valid swagger options e.g:
SWAGGER_UI_OPTIONS = {
displayOperationId: false,
docExpansion: 'none'
....
}
Then when parsing the options in swagger-ui.html, we can make use of the spread operator in case a default option is being overriden like so:
const options = {{ config.SWAGGER_UI_OPTIONS | default({}) | tojson }}
const ui = window.ui = new SwaggerUIBundle({
// Other options
...options
})
I like this idea. I'll give it a try when I have a moment.
Thanks for the suggestion.
@ziirish Have you been able to take a look at this?
Is there any discussion to add this configuration?
DEFAULT_MODELS_EXPAND_DEPTH = -1
@engmsilva The plan is to support all configurations so that developers can specify what configurations they want to pass into swagger.
+1
Is there any news about support additional Swagger options?
Hi, any updates on this? +1 I would use this feature
If we're just waiting on someone to implement it, I can do it