Sha256: 3834f926862a607f7ddad0674646daf18fce168a98fe0949167e3955f0cd7351

Contents?: true

Size: 322 Bytes

Versions: 3

Compression:

Stored size: 322 Bytes

Contents

class OpenAPIParser::SchemaValidator
  class NilValidator < Base
    # @param [Object] value
    # @param [OpenAPIParser::Schemas::Schema] schema
    def coerce_and_validate(value, schema)
      return [value, nil] if schema.nullable
      [nil, OpenAPIParser::NotNullError.new(schema.object_reference)]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openapi_parser-0.1.5 lib/openapi_parser/schema_validators/nil_validator.rb
openapi_parser-0.1.4 lib/openapi_parser/schema_validators/nil_validator.rb
openapi_parser-0.1.3 lib/openapi_parser/schema_validators/nil_validator.rb