Skip to content
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

Configurable collapse mode for swagger UI #165

Open
Michal-Kubricht opened this issue Mar 29, 2019 · 2 comments
Open

Configurable collapse mode for swagger UI #165

Michal-Kubricht opened this issue Mar 29, 2019 · 2 comments

Comments

@Michal-Kubricht
Copy link

Describe the feature

Introduce new configuration option to choose collapse mode of generated swagger UI documentation.

The template of swagger UI itself allows easily to define default collapsing behavior over "docExpansion" property in SwaggerUIBundle definition.

See:

docExpansion: 'full', // expand by default

Swagger UI documentation defines "docExpansion" with three available modes "none", "list", "full". All three defines default view on page load and all make sense for different use-cases.
See https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md#display

Currently, only fixed value with "full" value is possible to be generated using gradle-swagger-generator-plugin.

Why do you want the feature?

It would be really useful to have this option, because there are some use-cases especially for larger projects (with several tags defined) where default behavior of everything expanded is super-annoying for readers. It all the time leads for reader to manually collapse all UI elements and then start using the documentation.

Anyone who wants to workaround this issue can do same trick as me: generate HTML documentation using gradle plugin and then post-process the output by another script. The script does an easy work, replace "docExpansion" value with the one you need in a file index.html. The workaround is a bit fragile and hacky, but works up to this point.

@int128
Copy link
Owner

int128 commented Mar 30, 2019

Thank you for your suggestion.

At this time the plugin does not support Swagger UI options. You can replace the default index.html with your one after the task. See the example as https://github.com/int128/gradle-swagger-generator-plugin/blob/master/README.md#configure-swagger-ui.

This is because Swagger UI has many options and I don't want to maintain the options.

@tjb
Copy link

tjb commented Apr 18, 2019

just a thought but if this option is a default option present in the json object we should be able to interact with me as i found that i would like it collapsed as well. just a thought. i would not mind trying to contribute this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants