Skip to content

Commit 8183d19

Browse files
author
Tim Vandecasteele
committed
Add support for nested parameters.
1 parent 5a40a79 commit 8183d19

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/grape-swagger.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,13 @@ def self.setup(options)
107107
def parse_params(params, path, method)
108108
params.map do |param, value|
109109
value[:type] = 'file' if value.is_a?(Hash) && value[:type] == 'Rack::Multipart::UploadedFile'
110-
111110
dataType = value.is_a?(Hash) ? value[:type]||'String' : 'String'
112111
description = value.is_a?(Hash) ? value[:desc] : ''
113112
required = value.is_a?(Hash) ? !!value[:required] : false
114113
paramType = path.match(":#{param}") ? 'path' : (method == 'POST') ? 'body' : 'query'
115114
{
116115
paramType: paramType,
117-
name: param,
116+
name: value[:full_name] || param,
118117
description: description,
119118
dataType: dataType,
120119
required: required
@@ -142,7 +141,7 @@ class Object
142141
# @person ? @person.name : nil
143142
# vs
144143
# @person.try(:name)
145-
#
144+
#
146145
# File activesupport/lib/active_support/core_ext/object/try.rb#L32
147146
def try(*a, &b)
148147
if a.empty? && block_given?

0 commit comments

Comments
 (0)