class JSchema::Validator::AnyOf
Private Instance Methods
post_initialize(any_of)
click to toggle source
# File lib/jschema/validator/any_of.rb, line 12 def post_initialize(any_of) @any_of = any_of.map.with_index do |sch, index| Schema.build(sch, parent, "anyOf/#{index}") end end
validate_args(any_of)
click to toggle source
# File lib/jschema/validator/any_of.rb, line 8 def validate_args(any_of) schema_array?(any_of, 'anyOf') || invalid_schema('anyOf', any_of) end
validate_instance(instance)
click to toggle source
# File lib/jschema/validator/any_of.rb, line 18 def validate_instance(instance) valid = @any_of.any? do |schema| schema.valid?(instance) end unless valid "#{instance} must be valid against any of the schemas" end end