lib/swagalicious/example_helpers.rb in swagalicious-0.3.0 vs lib/swagalicious/example_helpers.rb in swagalicious-0.3.1
- old
+ new
@@ -51,13 +51,11 @@
if request[:payload]
metadata[:response][:request] = Oj.load(request[:payload])
end
- # TODO: What if there is more than 1 produces?
- mime_type = metadata[:operation][:produces].first
-
- metadata[:response][:body] ||= { mime_type => { examples: { mime_type => @body } } }
+ metadata[:response][:examples] ||= {}
+ metadata[:response][:examples]["application/json"] = @body
# Validates response matches the proper schema
Swagalicious::ResponseValidator.new.validate!(metadata, response)
response