Module: OpenAPIParser::SchemaValidator::Enumable

Included in:
BooleanValidator, FloatValidator, IntegerValidator, StringValidator
Defined in:
lib/openapi_parser/schema_validator/enumable.rb

Instance Method Summary collapse

Instance Method Details

#check_enum_include(value, schema) ⇒ Object

check enum value by schema

Parameters:



6
7
8
9
10
11
# File 'lib/openapi_parser/schema_validator/enumable.rb', line 6

def check_enum_include(value, schema)
  return [value, nil] unless schema.enum
  return [value, nil] if schema.enum.include?(value)

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