Sha256: 8ea0e1054abed168d3c395857953689f176891f3e6f0f21ecb99165138206f08
Contents?: true
Size: 662 Bytes
Versions: 23
Compression:
Stored size: 662 Bytes
Contents
class OpenAPIParser::SchemaValidator class OneOfValidator < Base # @param [Object] value # @param [OpenAPIParser::Schemas::Schema] schema def coerce_and_validate(value, schema, **_keyword_args) if schema.discriminator return validate_discriminator_schema(schema.discriminator, value) end # if multiple schemas are satisfied, it's not valid result = schema.one_of.one? do |s| _coerced, err = validatable.validate_schema(value, s) err.nil? end if result [value, nil] else [nil, OpenAPIParser::NotOneOf.new(value, schema.object_reference)] end end end end
Version data entries
23 entries across 23 versions & 2 rubygems