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

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

Defined Under Namespace

Classes: CheckFactoryValidations, CheckInvalidFields

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(factory, raise_on_invalid: false) ⇒ Validator

Returns a new instance of Validator.



16
17
18
19
20
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 16

def initialize(factory, raise_on_invalid: false)
  @factory = factory
  @raise_on_invalid = raise_on_invalid
  @validatable = Validation::Validatable.new(factory)
end

Instance Attribute Details

#factoryObject (readonly)

Returns the value of attribute factory.



10
11
12
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 10

def factory
  @factory
end

#raise_on_invalidObject (readonly)

Returns the value of attribute raise_on_invalid.



10
11
12
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 10

def raise_on_invalid
  @raise_on_invalid
end

#validatableObject (readonly)

Returns the value of attribute validatable.



10
11
12
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 10

def validatable
  @validatable
end

Class Method Details

.call(*args, **kwargs) ⇒ Object



12
13
14
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 12

def self.call(*args, **kwargs)
  new(*args, **kwargs).call
end

Instance Method Details

#callObject



22
23
24
25
26
27
28
29
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 22

def call
  check_required_fields
  check_unexpected_fields
  check_mutually_exclusive_fields
  check_invalid_fields
  check_factory_validations
  validatable.collection
end