module Esquema::KeywordValidator
def self.validate_enum(property_name, type, enum)
-
(ArgumentError)
- If the enum is not an array.
Parameters:
-
enum
(Array
) -- The allowed values for the property. -
type
(Symbol
) -- The type of the property. -
property_name
(Symbol
) -- The name of the property being validated.
def self.validate_enum(property_name, type, enum) raise ArgumentError, "Enum for #{property_name} is not an array" unless enum.is_a?(Array) enum.each { |value| validate_value!(property_name, type, value, "enum") } end