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

Pass through all Swagger-UI options to more fully support customization #47

Open
davidbrewer opened this issue Mar 4, 2016 · 0 comments

Comments

@davidbrewer
Copy link
Contributor

Currently grape-swagger-rails has hard-coded support for passing through a few of the Swagger-UI options from the grape-swagger-rails initializer to the SwaggerUi initializer, in the index.html.erb file. Good examples of this include the docExpansion option, and the validatorUrl option. Here's a link to a recent pull request that added the validatorUrl option: #46.

@dblock rightfully pointed out that it would be better if we could come up with a clean way to pass through ALL of the Swagger-UI options, to completely support the features of Swagger-UI. Then we could strip out all the special case code that we currently have for supporting these options piecemeal.

There's a complete list of Swagger-UI options here: https://github.com/swagger-api/swagger-ui#parameters. I wonder if we might be best off making some kind of a whitelist of supported parameters to pass through, rather than just automatically passing through any and all options that are set. It will require a little more maintenance since when new options are added they would have to be added to the whitelist, but it might head off potential security issues.

Another point in favor of using some kind of list of supported parameters... it looks like the Swagger-UI params don't use a completely consistent case. Most are lowerCamelCase, but at least one (dom_id) is snake_case, which means that automatically converting from snake_case in the grape_swagger_rails.rb initializer to lowerCamelCase will fail in that case. Seems that a list showing how to translate from the Ruby name for the parameter to the JavaScript name for the parameter may be needed.

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

No branches or pull requests

2 participants