Class: WeakSwaggerParameters::Definitions::CollectionProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/weak_swagger_parameters/definitions/collection_property.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, description, model_class) ⇒ CollectionProperty

Returns a new instance of CollectionProperty.



6
7
8
9
10
# File 'lib/weak_swagger_parameters/definitions/collection_property.rb', line 6

def initialize(name, description, model_class)
  @name = name
  @description = description
  @model_class = model_class
end

Instance Method Details

#apply_docs(parent_node) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/weak_swagger_parameters/definitions/collection_property.rb', line 12

def apply_docs(parent_node)
  name = @name
  description = @description
  model_class = @model_class

  parent_node.instance_eval do
    property name, description: description, type: :array do
      items do
        key :'$ref', model_class.docs_model_name
      end
    end
  end
end