Class: WeakSwaggerParameters::Definitions::Property

Inherits:
Object
  • Object
show all
Includes:
LeafDefinition
Defined in:
lib/weak_swagger_parameters/definitions/property.rb

Instance Method Summary collapse

Methods included from LeafDefinition

#apply_validations

Constructor Details

#initialize(type, name, description, options = {}) ⇒ Property

Returns a new instance of Property.



8
9
10
# File 'lib/weak_swagger_parameters/definitions/property.rb', line 8

def initialize(type, name, description, options = {})
  @options = options.merge(name: name, type: type, description: description)
end

Instance Method Details

#apply_docs(parent_node) ⇒ Object



12
13
14
15
16
17
# File 'lib/weak_swagger_parameters/definitions/property.rb', line 12

def apply_docs(parent_node)
  name = @options[:name]
  property_options = WeakSwaggerParameters::Services::SwaggerOptionsAdapter.adapt(@options.except(:name, :required))

  parent_node.instance_eval { property name, property_options }
end