mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-23 06:16:42 +00:00
Merge pull request #4 from jdanielian/response-example
Only automatically save examples if examples are not given explicitly…
This commit is contained in:
commit
6467ce6543
12
.travis.yml
12
.travis.yml
@ -5,17 +5,25 @@ rvm:
|
||||
|
||||
env:
|
||||
- RAILS_VERSION=5.2.0
|
||||
- RAILS_VERSION=4.2.8
|
||||
# - RAILS_VERSION=4.2.8
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- /home/travis/.rvm/gems/ruby-2.5.1
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libqtwebkit-dev
|
||||
- libqtwebkit4
|
||||
|
||||
install: ./ci/build.sh
|
||||
|
||||
services:
|
||||
- xvfb
|
||||
|
||||
before_script:
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- sleep 3
|
||||
|
||||
script: ./ci/test.sh
|
||||
|
||||
@ -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