Sha256: d85fe15d48178ff8081c8679688eaf7b9316bd04e85a8d8b17d76164b7c56129
Contents?: true
Size: 687 Bytes
Versions: 15
Compression:
Stored size: 687 Bytes
Contents
require 'json-schema/attributes/format' require 'json-schema/errors/custom_format_error' module JSON class Schema class CustomFormat < FormatAttribute def initialize(validation_proc) @validation_proc = validation_proc end def validate(current_schema, data, fragments, processor, validator, options = {}) begin @validation_proc.call data rescue JSON::Schema::CustomFormatError => e message = "The property '#{self.class.build_fragment(fragments)}' #{e.message}" self.class.validation_error(processor, message, fragments, current_schema, self, options[:record_errors]) end end end end end
Version data entries
15 entries across 14 versions & 3 rubygems