Sha256: 9fafd07d39bcc79bf9d510ba221093daee67b500227f8f51c5347809b5a8ed7c
Contents?: true
Size: 747 Bytes
Versions: 15
Compression:
Stored size: 747 Bytes
Contents
module JSON class Schema class PatternPropertiesAttribute < Attribute def self.validate(current_schema, data, fragments, validator, options = {}) if data.is_a?(Hash) current_schema.schema['patternProperties'].each do |property,property_schema| r = Regexp.new(property) # Check each key in the data hash to see if it matches the regex data.each do |key,value| if r.match(key) schema = JSON::Schema.new(property_schema,current_schema.uri,validator) fragments << key schema.validate(data[key],fragments) fragments.pop end end end end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems