Class: OpenAPIParser::SchemaValidator::NilValidator

Inherits:
Base
  • Object
show all
Defined in:
lib/openapi_parser/schema_validator/nil_validator.rb

Instance Attribute Summary

Attributes inherited from Base

#validatable

Instance Method Summary collapse

Methods inherited from Base

#initialize, #validate_discriminator_schema

Constructor Details

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

Instance Method Details

#coerce_and_validate(value, schema, **_keyword_args) ⇒ Object

Parameters:



5
6
7
8
9
# File 'lib/openapi_parser/schema_validator/nil_validator.rb', line 5

def coerce_and_validate(value, schema, **_keyword_args)
  return [value, nil] if schema.nullable

  [nil, OpenAPIParser::NotNullError.new(schema.object_reference)]
end