Class: Fictium::OpenApi::V3Exporter::ParamFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/fictium/exporters/open_api/v3_exporter/param_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(ignore_name: false, ignore_in: false) ⇒ ParamFormatter

Returns a new instance of ParamFormatter.



5
6
7
8
# File 'lib/fictium/exporters/open_api/v3_exporter/param_formatter.rb', line 5

def initialize(ignore_name: false, ignore_in: false)
  @ignore_name = ignore_name
  @ignore_in = ignore_in
end

Instance Method Details

#format(name, section, hash) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/fictium/exporters/open_api/v3_exporter/param_formatter.rb', line 10

def format(name, section, hash)
  param = (hash || {})
  description = param.slice(:description, :required, :deprecated, :schema)
  description[:allowEmptyValue] = param[:allow_empty] if param[:allow_empty].present?
  add_required_fields(description)
  add_optional_fields(name, section, description)
  description
end