Class: Swagger::Blocks::Nodes::PropertyNode

Inherits:
Swagger::Blocks::Node show all
Defined in:
lib/swagger/blocks/nodes/property_node.rb

Constant Summary

Constants inherited from Swagger::Blocks::Node

Swagger::Blocks::Node::VERSION_2, Swagger::Blocks::Node::VERSION_3

Instance Attribute Summary

Attributes inherited from Swagger::Blocks::Node

#name, #version

Instance Method Summary collapse

Methods inherited from Swagger::Blocks::Node

#as_json, call, #data, #is_openapi_3_0?, #is_swagger_2_0?, #key, #keys, #ref?, #static_ref?, #value_as_json

Instance Method Details

#items(inline_keys = nil, &block) ⇒ Object


5
6
7
# File 'lib/swagger/blocks/nodes/property_node.rb', line 5

def items(inline_keys = nil, &block)
  self.data[:items] = Swagger::Blocks::Nodes::ItemsNode.call(version: version, inline_keys: inline_keys, &block)
end

#one_of(&block) ⇒ Object


15
16
17
18
# File 'lib/swagger/blocks/nodes/property_node.rb', line 15

def one_of(&block)
  self.data[:oneOf] ||= []
  self.data[:oneOf] << Swagger::Blocks::Nodes::OneOfNode.call(version: version, &block)
end

#property(name, inline_keys = nil, &block) ⇒ Object


9
10
11
12
13
# File 'lib/swagger/blocks/nodes/property_node.rb', line 9

def property(name, inline_keys = nil, &block)
  self.data[:properties] ||= Swagger::Blocks::Nodes::PropertiesNode.new
  self.data[:properties].version = version
  self.data[:properties].property(name, inline_keys, &block)
end