Sha256: fadff2c9bf36a08be200e93549d101e4cb27e665c088a6b76eb4cab281a2cf9c
Contents?: true
Size: 628 Bytes
Versions: 3
Compression:
Stored size: 628 Bytes
Contents
require 'json-schema/attribute' module JSON class Schema class PatternAttribute < Attribute def self.validate(current_schema, data, fragments, processor, validator, options = {}) if data.is_a?(String) r = Regexp.new(current_schema.schema['pattern']) if (r.match(data)).nil? message = "The property '#{build_fragment(fragments)}' value #{data.inspect} did not match the regex '#{current_schema.schema['pattern']}'" validation_error(processor, message, fragments, current_schema, self, options[:record_errors]) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
json-schema-2.4.1 | lib/json-schema/attributes/pattern.rb |
json-schema-2.4.0 | lib/json-schema/attributes/pattern.rb |
json-schema-2.3.0 | lib/json-schema/attributes/pattern.rb |