Module: OpenAPIParser::SchemaValidator::MinimumMaximum

Included in:
FloatValidator, IntegerValidator
Defined in:
lib/openapi_parser/schema_validator/minimum_maximum.rb

Instance Method Summary collapse

Instance Method Details

#check_minimum_maximum(value, schema) ⇒ Object

check minimum and maximum value by schema

Parameters:



6
7
8
9
10
11
12
13
14
# File 'lib/openapi_parser/schema_validator/minimum_maximum.rb', line 6

def check_minimum_maximum(value, schema)
  include_min_max = schema.minimum || schema.maximum
  return [value, nil] unless include_min_max

  validate(value, schema)
  [value, nil]
rescue OpenAPIParser::OpenAPIError => e
  return [nil, e]
end