Sha256: f79c90486c56151f4bd45de4128548b9cec423aa356f2c0c1666515adb5283b5
Contents?: true
Size: 903 Bytes
Versions: 8
Compression:
Stored size: 903 Bytes
Contents
module JSON class Schema class PropertiesAttribute < Attribute def self.validate(current_schema, data, fragments, validator, options = {}) if data.is_a?(Hash) current_schema.schema['properties'].each do |property,property_schema| if (property_schema['required'] && !data.has_key?(property)) message = "The property '#{build_fragment(fragments)}' did not contain a required property of '#{property}'" validation_error(message, fragments, current_schema, self, options[:record_errors]) end if data.has_key?(property) schema = JSON::Schema.new(property_schema,current_schema.uri,validator) fragments << property schema.validate(data[property],fragments,options) fragments.pop end end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems