Class: Openapi3Parser::NodeFactory::ObjectFactory::Validator::CheckInvalidFields

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/openapi3_parser/node_factory/object_factory/validator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(validator) ⇒ CheckInvalidFields

Returns a new instance of CheckInvalidFields.



83
84
85
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 83

def initialize(validator)
  @validator = validator
end

Instance Attribute Details

#validatorObject (readonly)

Returns the value of attribute validator.



75
76
77
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 75

def validator
  @validator
end

Class Method Details

.call(validator) ⇒ Object



79
80
81
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 79

def self.call(validator)
  new(validator).call
end

Instance Method Details

#callObject



87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 87

def call
  factory.data.each do |name, field|
    # references can reference themselves and become in a loop
    next if in_recursive_loop?(field)
    has_factory_errors = handle_factory_checks(name)

    next if has_factory_errors || !field.respond_to?(:errors)

    # We don't add errors when we're building a node as they will
    # be raised when that child node is built
    validatable.add_errors(field.errors) unless building_node
  end
end