Module: OpenAPIParser::SchemaValidator::PropertiesNumber

Included in:
ObjectValidator
Defined in:
lib/openapi_parser/schema_validator/properties_number.rb

Instance Method Summary collapse

Instance Method Details

#check_properties_number(value, schema) ⇒ Object

check minProperties and manProperties value by schema

Parameters:



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

def check_properties_number(value, schema)
  include_properties_num = schema.minProperties || schema.maxProperties
  return [value, nil] unless include_properties_num

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