Class: OpenAPIParser::SchemaValidator::BooleanValidator
- Includes:
- Enumable
- Defined in:
- lib/openapi_parser/schema_validator/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 included from Enumable
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
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/openapi_parser/schema_validator/boolean_validator.rb', line 8 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, err = check_enum_include(value, schema) return [nil, err] if err [value, nil] end |