Class: RspecApiDocumentation::OpenApi::Parameter

Inherits:
Node
  • Object
show all
Defined in:
lib/rspec_api_documentation/open_api/parameter.rb

Constant Summary

Constants inherited from Node

Node::CHILD_CLASS

Instance Attribute Summary collapse

Attributes inherited from Node

#hide

Instance Method Summary collapse

Methods inherited from Node

add_setting, #add_setting, #as_json, #assign_setting, #existing_settings, #initialize, #safe_assign_setting, #setting, #setting_exist?, #setting_schema

Constructor Details

This class inherits a constructor from RspecApiDocumentation::OpenApi::Node

Instance Attribute Details

#valueObject

Required to write example values to description of parameter when option ‘with_example: true` is provided



5
6
7
# File 'lib/rspec_api_documentation/open_api/parameter.rb', line 5

def value
  @value
end

#with_exampleObject

Returns the value of attribute with_example.



6
7
8
# File 'lib/rspec_api_documentation/open_api/parameter.rb', line 6

def with_example
  @with_example
end

Instance Method Details

#description_with_exampleObject Also known as: description



20
21
22
23
24
25
26
27
# File 'lib/rspec_api_documentation/open_api/parameter.rb', line 20

def description_with_example
  str = description_without_example.dup || ''
  if with_example && value
    str << "\n" unless str.empty?
    str << "Eg, `#{value}`"
  end
  str
end