Merge pull request #392 from pfilipow/master

don't clobber response content
This commit is contained in:
Blake Erickson 2021-01-26 18:10:21 -07:00 committed by GitHub
commit d645df207e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -118,7 +118,7 @@ module Rswag
def build_query_string_part(param, value)
name = param[:name]
return "#{name}=#{value}" unless param[:type].to_sym == :array
return "#{name}=#{value}" unless param[:type]&.to_sym == :array
case param[:collectionFormat]
when :ssv

View File

@ -129,13 +129,14 @@ module Rswag
end
def upgrade_content!(mime_list, target_node)
target_node.merge!(content: {})
target_node.merge!(content: {}) if target_node[:content].nil?
schema = target_node[:schema]
return if mime_list.empty? || schema.nil?
mime_list.each do |mime_type|
# TODO upgrade to have content-type specific schema
target_node[:content][mime_type] = { schema: schema }
target_node[:content][mime_type] = {} if target_node[:content][mime_type].nil?
target_node[:content][mime_type][:schema] = schema
end
end