Sha256: ed95e65c8440f72c68e3ee7c1af4cd4fea53143ade54f5f3247705b34556d48c

Contents?: true

Size: 486 Bytes

Versions: 11

Compression:

Stored size: 486 Bytes

Contents

class OpenAPIParser::SchemaValidator
  class AnyOfValidator < Base
    # @param [Object] value
    # @param [OpenAPIParser::Schemas::Schema] schema
    def coerce_and_validate(value, schema)
      # in all schema return error (=true) not any of data
      schema.any_of.each do |s|
        coerced, err = validatable.validate_schema(value, s)
        return [coerced, nil] if err.nil?
      end
      [nil, OpenAPIParser::NotAnyOf.new(value, schema.object_reference)]
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
openapi_parser-0.2.6 lib/openapi_parser/schema_validators/any_of_validator.rb
openapi_parser-0.2.5 lib/openapi_parser/schema_validators/any_of_validator.rb
openapi_parser-0.2.4 lib/openapi_parser/schema_validators/any_of_validator.rb
openapi_parser-0.2.3 lib/openapi_parser/schema_validators/any_of_validator.rb
openapi_parser-0.2.2 lib/openapi_parser/schema_validators/any_of_validator.rb
openapi_parser-0.2.1 lib/openapi_parser/schema_validators/any_of_validator.rb
openapi_parser-0.2.0 lib/openapi_parser/schema_validators/any_of_validator.rb
openapi_parser-0.1.9 lib/openapi_parser/schema_validators/any_of_validator.rb
openapi_parser-0.1.8 lib/openapi_parser/schema_validators/any_of_validator.rb
openapi_parser-0.1.7 lib/openapi_parser/schema_validators/any_of_validator.rb
openapi_parser-0.1.6 lib/openapi_parser/schema_validators/any_of_validator.rb