mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-22 22:06:43 +00:00
Show the response body for comparison when schema checks fail
This commit is contained in:
parent
0aca50c66c
commit
a34c931bb6
@ -50,7 +50,11 @@ module Rswag
|
|||||||
.merge(schemas)
|
.merge(schemas)
|
||||||
|
|
||||||
errors = JSON::Validator.fully_validate(validation_schema, body)
|
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
|
end
|
||||||
|
|
||||||
def definitions_or_component_schemas(swagger_doc, version)
|
def definitions_or_component_schemas(swagger_doc, version)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user