Skip to content

Commit 95d0ec1

Browse files
committed
(Attempt to) address PR comments: make param_type_is_array? more explicit
1 parent c3397c2 commit 95d0ec1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/grape-swagger/endpoint.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ def parse_request_params(required)
237237

238238
def param_type_is_array?(param_type)
239239
return false unless param_type
240-
param_type == 'Array' || param_type =~ /\[\w+\]\z/
240+
return true if param_type == 'Array'
241+
param_types = param_type.match(/\[(.*)\]$/)
242+
return false unless param_types
243+
param_types = param_types[0].split(',') if param_types
244+
param_types.size == 1
241245
end
242246

243247
def expose_params_from_model(model)

0 commit comments

Comments
 (0)