Class: RailsOpenapiGen::AstNodes::PropertyNodeFactory

Inherits:
NodeFactory
  • Object
show all
Defined in:
lib/rails-openapi-gen/ast_nodes.rb

Overview

Legacy compatibility classes - will be deprecated These maintain backward compatibility with existing code

Class Method Summary collapse

Methods inherited from NodeFactory

create_partial, create_property, create_tree, from_hash_array

Class Method Details

.create_array(property:, comment_data: nil, is_conditional: false, array_item_properties: []) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/rails-openapi-gen/ast_nodes.rb', line 30

def create_array(property:, comment_data: nil, is_conditional: false, array_item_properties: [])
  node = NodeFactory.create_array(
    property_name: property,
    comment_data: comment_data,
    is_conditional: is_conditional
  )
  array_item_properties.each { |item| node.add_item(item) }
  node
end

.create_array_root(comment_data: nil, array_item_properties: []) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/rails-openapi-gen/ast_nodes.rb', line 50

def create_array_root(comment_data: nil, array_item_properties: [])
  node = NodeFactory.create_array(
    comment_data: comment_data,
    is_root_array: true
  )
  array_item_properties.each { |item| node.add_item(item) }
  node
end

.create_object(property:, comment_data: nil, is_conditional: false, nested_properties: []) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/rails-openapi-gen/ast_nodes.rb', line 40

def create_object(property:, comment_data: nil, is_conditional: false, nested_properties: [])
  node = NodeFactory.create_object(
    property_name: property,
    comment_data: comment_data,
    is_conditional: is_conditional
  )
  nested_properties.each { |prop| node.add_property(prop) }
  node
end

.create_simple(property:, comment_data: nil, is_conditional: false) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/rails-openapi-gen/ast_nodes.rb', line 22

def create_simple(property:, comment_data: nil, is_conditional: false)
  NodeFactory.create_property(
    property_name: property,
    comment_data: comment_data,
    is_conditional: is_conditional
  )
end

.from_hash(hash_data) ⇒ Object



18
19
20
# File 'lib/rails-openapi-gen/ast_nodes.rb', line 18

def from_hash(hash_data)
  NodeFactory.from_hash(hash_data)
end