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

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(validator) ⇒ Object



135
136
137
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 135

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

Instance Method Details

#call(validator) ⇒ Object

Raises:



139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/openapi3_parser/node_factory/object_factory/validator.rb', line 139

def call(validator)
  run_validations(validator)

  errors = validator.validatable.errors

  return if errors.empty? || !validator.raise_on_invalid

  location_summary = errors.first.context.location_summary
  raise Error::InvalidData,
        "Invalid data for #{location_summary}: " \
        "#{errors.first.message}"
end