lib/swagalicious/swagger_formatter.rb in swagalicious-0.2.0 vs lib/swagalicious/swagger_formatter.rb in swagalicious-0.3.0
- old
+ new
@@ -123,10 +123,14 @@
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 }
+ body = target_node
+ .fetch(:body, {})
+ .fetch(mime_type, {})
+
+ target_node[:content][mime_type] = { schema: schema }.merge(body)
end
end
def upgrade_request_type!(metadata)
# No deprecation here as it seems valid to allow type as a shorthand