Class: RailsOpenapiGen::AstNodes::ObjectPropertyNode

Inherits:
ObjectNode show all
Defined in:
lib/rails-openapi-gen/ast_nodes.rb

Instance Attribute Summary

Attributes inherited from ObjectNode

#comment_data, #is_conditional, #property_name

Attributes inherited from BaseNode

#children, #metadata, #parent

Instance Method Summary collapse

Methods inherited from ObjectNode

#accept, #add_property, #description, #find_property, #has_properties?, #optional?, #optional_properties, #properties, #required?, #required_properties, #to_h

Methods inherited from BaseNode

#accept, #add_child, #debug_line, #descendants, #leaf?, #pretty_print, #remove_child, #root, #root?, #summary_attributes, #to_h

Constructor Details

#initialize(property:, comment_data: nil, is_conditional: false, nested_properties: []) ⇒ ObjectPropertyNode

Returns a new instance of ObjectPropertyNode.



92
93
94
95
# File 'lib/rails-openapi-gen/ast_nodes.rb', line 92

def initialize(property:, comment_data: nil, is_conditional: false, nested_properties: [])
  super(property_name: property, comment_data: comment_data, is_conditional: is_conditional)
  nested_properties.each { |prop| add_property(prop) }
end

Instance Method Details

#add_nested_property(property_node) ⇒ Object



105
106
107
# File 'lib/rails-openapi-gen/ast_nodes.rb', line 105

def add_nested_property(property_node)
  add_property(property_node)
end

#nested_propertiesObject



101
102
103
# File 'lib/rails-openapi-gen/ast_nodes.rb', line 101

def nested_properties
  properties
end

#propertyObject



97
98
99
# File 'lib/rails-openapi-gen/ast_nodes.rb', line 97

def property
  property_name
end