mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 15:22:56 +00:00
Compare commits
10 Commits
2.4.0
...
revert-300
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
989aab656f | ||
|
|
f7036b7e5a | ||
|
|
84ab7a9e4c | ||
|
|
0169fbab66 | ||
|
|
4c42ad5f97 | ||
|
|
b91b6e5f1e | ||
|
|
a34c931bb6 | ||
|
|
4b7ab9d381 | ||
|
|
3d3d93f3ab | ||
|
|
f8dbd98bbc |
2
.github/workflows/ruby.yml
vendored
2
.github/workflows/ruby.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
ruby: [2.6, 2.7]
|
||||
ruby: [2.6, 2.7, truffleruby-head]
|
||||
rails: [5.2.4.4, 6.0.3.4]
|
||||
env:
|
||||
RAILS_VERSION: ${{ matrix.rails }}
|
||||
|
||||
6
Gemfile
6
Gemfile
@@ -25,18 +25,20 @@ end
|
||||
gem 'rswag-api', path: './rswag-api'
|
||||
gem 'rswag-ui', path: './rswag-ui'
|
||||
|
||||
group :development, :test do
|
||||
gem 'rswag-specs', path: './rswag-specs'
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem 'capybara'
|
||||
gem 'geckodriver-helper'
|
||||
gem 'generator_spec'
|
||||
gem 'rspec-rails'
|
||||
gem 'selenium-webdriver'
|
||||
gem 'rswag-specs', path: './rswag-specs'
|
||||
gem 'test-unit'
|
||||
end
|
||||
|
||||
group :development do
|
||||
gem 'rswag-specs', path: './rswag-specs'
|
||||
gem 'rubocop'
|
||||
end
|
||||
|
||||
|
||||
@@ -50,7 +50,11 @@ module Rswag
|
||||
.merge(schemas)
|
||||
|
||||
errors = JSON::Validator.fully_validate(validation_schema, body)
|
||||
raise UnexpectedResponse, "Expected response body to match schema: #{errors[0]}" if errors.any?
|
||||
return unless errors.any?
|
||||
|
||||
raise UnexpectedResponse,
|
||||
"Expected response body to match schema: #{errors[0]}\n" \
|
||||
"Response body: #{JSON.pretty_generate(JSON.parse(body))}"
|
||||
end
|
||||
|
||||
def definitions_or_component_schemas(swagger_doc, version)
|
||||
@@ -62,7 +66,7 @@ module Rswag
|
||||
swagger_doc.slice(:definitions)
|
||||
else
|
||||
components = swagger_doc[:components] || {}
|
||||
{ components: { schemas: components[:schemas] } }
|
||||
{ components: components }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user