bharel / mkdocs-render-swagger-plugin

A plugin for MKDocs for rendering swagger & openapi schemas using SwaggerUI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pass configuration to SwaggerUIBundle

Auo opened this issue · comments

It would be nice if it was possible to configure Swagger-UI via a parameter,

For example if you want control which sections are expanded.

SwaggerUIBundle({
  ...
  "docExpansion":"none"
});

I'm not sure how to do this nicely, but maybe a configuration in mkdocs.yaml and in the extra section, or maybe it's easier to supply it every time you use the plugin?

!!swagger FILENAME "docExpansion":"none","someOtherSetting":"value"!!

An easier option would be to use configUrl, I believe that SwaggerUIBundle will load from that URL.

!!swagger FILENAME SWAGGER_CONFIG!!

!!swagger URL SWAGGER_CONFIG_URL!!

Thank you for creating the plugin!

@Auo I created another MkDocs plugin to render Swagger UI https://github.com/blueswen/mkdocs-swagger-ui-tag. Which could configure Swagger UI through plugin options globally or tag attributes separately. You can see demo and check more details on my plugin document. Hope this could help you.

Yes, I need this too! Passing especially the docExpansion parameter would be a significant improvement. For example, it could look like this in mkdocs.yml:

plugins:
    render_swagger:
        docExpansion: none

I prefer the configuration to be part of the !!swagger!! command, so you'll be able to set it for every embedded docs.
I'd appreciate more ideas for a syntax. Maybe something like !!swagger <config={...}> FILE for easier separation? The config will be pasted straight into the SwaggerUI tag so it will support everything.