module Esquema::KeywordValidator

def self.validate_value!(property_name, type, value, keyword)

Raises:
  • (ArgumentError) - If the value does not match the type.

Parameters:
  • keyword (String) -- The keyword being validated (e.g., "default", "enum").
  • value (Object) -- The value to be validated.
  • type (Symbol) -- The type of the property.
  • property_name (Symbol) -- The name of the property being validated.
def self.validate_value!(property_name, type, value, keyword)
  validator = TYPE_VALIDATORS[type]
  return if validator.call(value)
  raise ArgumentError, "#{keyword.capitalize} value for #{property_name} does not match type #{type}"
end