def self.validate(current_schema, data, fragments, processor, validator, options = {})
errors = []
valid = false
current_schema.schema['anyOf'].each do |element|
schema = JSON::Schema.new(element,current_schema.uri,validator)
pre_validation_error_count = validation_errors(processor).count
begin
schema.validate(data,fragments,processor,options)
valid = true
rescue ValidationError
end
diff = validation_errors(processor).count - pre_validation_error_count
valid = false if diff > 0
while diff > 0
diff = diff - 1
errors.push(validation_errors(processor).pop)
end
break if valid
end
if !valid
message = "The property '#{build_fragment(fragments)}' of type #{data.class} did not match one or more of the required schemas"
validation_error(processor, message, fragments, current_schema, self, options[:record_errors])
validation_errors(processor).last.sub_errors = errors
end
end