lib/swagalicious/example_helpers.rb in swagalicious-0.2.0 vs lib/swagalicious/example_helpers.rb in swagalicious-0.3.0

- old
+ new

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