Allow returning arrays

This commit is contained in:
Craig S. Cottingham 2014-05-30 09:41:34 -05:00
parent eb3991c351
commit 865acf999c
1 changed files with 13 additions and 1 deletions

View File

@ -159,8 +159,20 @@ module Grape
if operation[:parameters].any? { | param | param[:type] == "File" }
operation.merge!(:consumes => [ "multipart/form-data" ])
end
operation.merge!(:type => parse_entity_name(route.route_entity)) if route.route_entity
operation.merge!(:responseMessages => http_codes) unless http_codes.empty?
if route.route_entity
type = parse_entity_name(route.route_entity)
if route.instance_variable_get(:@options)[:is_array]
operation.merge!({
"type" => "array",
"items" => generate_typeref(type)
})
else
operation.merge!("type" => type)
end
end
operation
end.compact
apis << {