We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d205202 commit 2f35d85Copy full SHA for 2f35d85
lib/grape-swagger.rb
@@ -322,8 +322,10 @@ def parse_entity_models(models)
322
end
323
324
if p.delete(:is_array)
325
- p[:items] = {"$ref" => p[:type]}
+ p[:items] = generate_typeref(p[:type])
326
p[:type] = "array"
327
+ else
328
+ p.merge! generate_typeref(p.delete(:type))
329
330
331
# rename Grape Entity's "desc" to "description"
@@ -344,6 +346,18 @@ def parse_entity_models(models)
344
346
result
345
347
348
349
+ def is_primitive?(type)
350
+ %w(integer long float double string byte boolean date dateTime).include? type
351
+ end
352
+
353
+ def generate_typeref(type)
354
+ if is_primitive? type
355
+ { "type" => type }
356
357
+ { "$ref" => type }
358
359
360
361
def parse_http_codes codes
362
codes ||= {}
363
codes.map do |k, v|
0 commit comments