Class: OpenAPIParser::SchemaValidator::AllOfValidator

Inherits:
Base
  • Object
show all
Defined in:
lib/openapi_parser/schema_validators/all_of_validator.rb

Instance Attribute Summary

Attributes inherited from Base

#validatable

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from OpenAPIParser::SchemaValidator::Base

Instance Method Details

#coerce_and_validate(value, schema) ⇒ Object

coerce and validate value

Parameters:



7
8
9
10
11
12
13
14
# File 'lib/openapi_parser/schema_validators/all_of_validator.rb', line 7

def coerce_and_validate(value, schema)
  # if any schema return error, it's not valida all of value
  schema.all_of.each do |s|
    _coerced, err = validatable.validate_schema(value, s)
    return [nil, err] if err
  end
  [value, nil]
end