Class: OpenAPIParser::SchemaValidator::BooleanValidator
- Defined in:
- lib/openapi_parser/schema_validators/boolean_validator.rb
Constant Summary collapse
- TRUE_VALUES =
['true', '1'].freeze
- FALSE_VALUES =
['false', '0'].freeze
Instance Attribute Summary
Attributes inherited from Base
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
6 7 8 9 10 11 12 |
# File 'lib/openapi_parser/schema_validators/boolean_validator.rb', line 6 def coerce_and_validate(value, schema, **_keyword_args) value = coerce(value) if @coerce_value return OpenAPIParser::ValidateError.build_error_result(value, schema) unless value.kind_of?(TrueClass) || value.kind_of?(FalseClass) [value, nil] end |