def self.validate(current_schema, data, fragments, processor, validator, options = {})
validation_errors = 0
current_schema.schema['oneOf'].each do |element|
schema = JSON::Schema.new(element,current_schema.uri,validator)
begin
schema.validate(data,fragments,processor,options.merge(:record_errors => false))
rescue ValidationError
validation_errors += 1
end
end
case validation_errors
when current_schema.schema['oneOf'].length - 1
message = nil
when current_schema.schema['oneOf'].length
message = "The property '#{build_fragment(fragments)}' of type #{data.class} did not match any of the required schemas"
else
message = "The property '#{build_fragment(fragments)}' of type #{data.class} matched more than one of the required schemas"
end
validation_error(processor, message, fragments, current_schema, self, options[:record_errors]) if message
end