Skip to content

Commit 35c0dcf

Browse files
committed
Fix configs
1 parent 760e391 commit 35c0dcf

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

app/views/swagger_ui_engine/docs/show.html.erb

+17-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<script>
33
window.onload = function() {
44
// Build a system
5-
const ui = SwaggerUIBundle({
5+
const config = {
66
url: "http://petstore.swagger.io/v2/swagger.json",
77
dom_id: '#swagger-ui',
88
presets: [
@@ -13,19 +13,24 @@ window.onload = function() {
1313
SwaggerUIBundle.plugins.DownloadUrl
1414
],
1515
layout: "StandaloneLayout"
16-
})
16+
}
1717

18+
// begin customizations
19+
config.url = "<%= @swagger_url %>";
20+
config.validatorUrl = <%= @validator_url %>;
21+
config.oauth2RedirectUrl = "<%= oauth2_docs_path %>";
22+
config.docExpansion = "<%= @doc_expansion %>";
23+
// config.jsonEditor = "<%= @json_editor %>"; // not implemented
24+
// l10n (translations) is not implemented.
25+
// config.defaultModelRendering = "<%= @model_rendering %>";
26+
// config.showRequestHeaders = "<%= @request_headers %>";
27+
config.displayOperationId = false;
28+
// end customizations
29+
30+
const ui = SwaggerUIBundle(config);
1831
window.ui = ui
1932

20-
ui.url = "<%= @swagger_url %>";
21-
ui.validatorUrl = <%= @validator_url %>;
22-
ui.oauth2RedirectUrl = "<%= oauth2_docs_path %>";
23-
ui.docExpansion = "<%= @doc_expansion %>";
24-
// ui.jsonEditor = "<%= @json_editor %>"; // not implemented
25-
// l10n (translations) is not implemented.
26-
// ui.defaultModelRendering = "<%= @model_rendering %>";
27-
// ui.showRequestHeaders = "<%= @request_headers %>";
28-
// ui.showOperationIds = false;
33+
// begin customizations
2934
ui.initOAuth({
3035
clientId: "<%= @oauth_client_id %>",
3136
clientSecret: "<%= @oauth_client_secret %>",
@@ -34,6 +39,7 @@ window.onload = function() {
3439
scopeSeparator: "<%= @oauth_scope_separator %>",
3540
additionalQueryStringParams: "<%= @oauth_query_string_params %>"
3641
});
42+
// end customizations
3743
}
3844
</script>
3945
<% end %>

0 commit comments

Comments
 (0)