Sha256: 8a8b8d66492a6f09ec599ab660a9f185f565db43445597d22f25028c1d4d356c
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'json-schema/attribute' module JSON class Schema class DependenciesV4Attribute < Attribute def self.validate(current_schema, data, fragments, processor, validator, options = {}) if data.is_a?(Hash) current_schema.schema['dependencies'].each do |property,dependency_value| if data.has_key?(property.to_s) if dependency_value.is_a?(Array) dependency_value.each do |value| if !data.has_key?(value.to_s) message = "The property '#{build_fragment(fragments)}' has a property '#{property}' that depends on a missing property '#{value}'" validation_error(processor, message, fragments, current_schema, self, options[:record_errors]) end end elsif dependency_value.is_a?(Hash) schema = JSON::Schema.new(dependency_value,current_schema.uri,validator) schema.validate(data, fragments, processor, options) end end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
json-schema-2.4.1 | lib/json-schema/attributes/dependencies_v4.rb |