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

1.1.4 version #38

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
3 changes: 1 addition & 2 deletions app/controllers/swagger_ui_engine/swagger_docs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class SwaggerDocsController < SwaggerUiEngine::ApplicationController

before_action :set_configs, :set_oauth_configs

def oauth2
end
def oauth2; end

def index
# backward compatibility for defining single doc url in strings
Expand Down
6 changes: 5 additions & 1 deletion app/views/swagger_ui_engine/swagger_docs/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<% content_for(:head) do %>
<script type="text/javascript">
function validationUrl(url) {
return url === 'null' ? null : url;
}

$(function () {
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
Expand All @@ -18,7 +22,7 @@
}
window.swaggerUi = new SwaggerUi({
url: url,
validatorUrl: "<%= @validator_url %>",
validatorUrl: validationUrl("<%= @validator_url %>"),
oauth2RedirectUrl: "<%= oauth2_swagger_docs_url %>",
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
Expand Down
2 changes: 1 addition & 1 deletion swagger_ui_engine.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Gem::Specification.new do |s|
'CHANGELOG.md'
]

s.add_runtime_dependency 'rails', '>= 4.2', '< 6'
s.add_runtime_dependency 'rails', '>= 4.2', '< 6.1'
s.add_runtime_dependency 'sassc-rails'
end
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ class SwaggerDocsControllerTest < ActionDispatch::IntegrationTest
assert_response :success
assert_match('showRequestHeaders: "false"', @response.body)
assert_match('jsonEditor: "false"', @response.body)
assert_match('validatorUrl: "null"', @response.body)
assert_match('clientId: "your-client-id"', @response.body)
assert_match('clientSecret: "your-client-secret-if-required"', @response.body)
assert_match('scopeSeparator: " "', @response.body)
assert_match('additionalQueryStringParams: "{}"', @response.body)
end

test 'validatorUrl should should check the url to validate the given url or return real null' do
get '/swagger/swagger_docs/v1'
assert_match('validatorUrl: validationUrl("null")', @response.body)
end
end
end