add specific test for formData

This commit is contained in:
Greg Myers
2020-04-04 23:05:26 +01:00
parent e53f2ca257
commit b158f1e164
2 changed files with 35 additions and 1 deletions

View File

@@ -55,7 +55,7 @@ module Rswag
v.each_pair do |_verb, value|
is_hash = value.is_a?(Hash)
if is_hash && value.dig(:parameters)
schema_param = value.dig(:parameters)&.find { |p| p[:in] == :body && p[:schema] }
schema_param = value.dig(:parameters)&.find { |p| (p[:in] == :body || p[:in] == :formData) && p[:schema] }
mime_list = value.dig(:consumes)
if value && schema_param && mime_list
value[:requestBody] = { content: {} } unless value.dig(:requestBody, :content)