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.



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

def initialize(validator)
  @validator = validator
end

Instance Attribute Details

#validatorObject (readonly)

Returns the value of attribute validator.



68
69
70
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 68

def validator
  @validator
end

Class Method Details

.call(validator) ⇒ Object



72
73
74
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 72

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

Instance Method Details

#callObject



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 80

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