mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-23 06:16:42 +00:00
Merge pull request #406 from mynnx/specs-print-failed-body
Show the response body for comparison when schema checks fail
This commit is contained in:
commit
4c42ad5f97
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user