mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-22 22:06:43 +00:00
Only automatically save examples if examples are not given explicitly in the spec itself
This commit is contained in:
parent
ce8237110f
commit
5555edc59f
@ -238,7 +238,9 @@ module OpenApi
|
||||
|
||||
if body_parameter && respond_to?(body_parameter[:name]) && example.metadata[:operation][:requestBody][:content]['application/json']
|
||||
# save response examples by default
|
||||
example.metadata[:response][:examples] = { 'application/json' => JSON.parse(response.body, symbolize_names: true) } unless response.body.to_s.empty?
|
||||
if example.metadata[:response][:examples].nil? || example.metadata[:response][:examples].empty?
|
||||
example.metadata[:response][:examples] = { 'application/json' => JSON.parse(response.body, symbolize_names: true) } unless response.body.to_s.empty?
|
||||
end
|
||||
|
||||
# save request examples using the let(:param_name) { REQUEST_BODY_HASH } syntax in the test
|
||||
if response.code.to_s =~ /^2\d{2}$/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user