Class: GrapeSwagger::DocMethods::ParseParams

Inherits:
Object
  • Object
show all
Defined in:
lib/grape-swagger/doc_methods/parse_params.rb

Class Method Summary collapse

Class Method Details

.call(param, settings, path, route, definitions) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/grape-swagger/doc_methods/parse_params.rb', line 7

def call(param, settings, path, route, definitions)
  method = route.request_method
  additional_documentation = settings.fetch(:documentation, {})
  settings.merge!(additional_documentation)
  data_type = DataType.call(settings)

  value_type = settings.merge(data_type: data_type, path: path, param_name: param, method: method)

  # required properties
  @parsed_param = {
    in: param_type(value_type),
    name: settings[:full_name] || param
  }

  # optional properties
  document_description(settings)
  document_type_and_format(settings, data_type)
  document_array_param(value_type, definitions) if value_type[:is_array]
  document_default_value(settings) unless value_type[:is_array]
  document_range_values(settings) unless value_type[:is_array]
  document_required(settings)
  document_additional_properties(settings)

  @parsed_param
end