Sha256: dd406682a2115485e0c33cf256f0dc6c8ac884f4edf7fc6efcf5be3073b5804d
Contents?: true
Size: 679 Bytes
Versions: 12
Compression:
Stored size: 679 Bytes
Contents
require 'json-schema/attribute' 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
12 entries across 12 versions & 2 rubygems