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, route) ⇒ Object



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

def call(param, settings, route)
  path = route.route_path
  method = route.route_method

  data_type = GrapeSwagger::DocMethods::DataType.call(settings)
  additional_documentation = settings[:documentation]
  if additional_documentation
    settings = additional_documentation.merge(settings)
  end

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

  @parsed_param = {
    in:            param_type(value_type),
    name:          settings[:full_name] || param,
    description:   settings[:desc] || settings[:description] || nil
  }

  document_type_and_format(data_type)
  document_array_param(value_type)
  document_default_value(settings)
  document_range_values(settings)
  document_required(settings)

  @parsed_param
end