Sha256: 8e835677a17d151fc0fc0da76d1b22261b83e17c6b8c1346e5dd1d27c3fc6338
Contents?: true
Size: 693 Bytes
Versions: 1
Compression:
Stored size: 693 Bytes
Contents
require 'json-schema/attribute' require 'json-schema/errors/custom_format_error' require 'uri' 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
json-schema-2.3.0 | lib/json-schema/attributes/formats/custom.rb |