json-schema 2.1.5 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
data/README.textile
CHANGED
@@ -6,7 +6,7 @@ module JSON
|
|
6
6
|
current_schema.schema['dependencies'].each do |property,dependency_value|
|
7
7
|
if (data.has_key?(property.to_s) || data.has_key?(property.to_sym)) && dependency_value.is_a?(Array)
|
8
8
|
dependency_value.each do |value|
|
9
|
-
if !data.has_key?(value.to_s)
|
9
|
+
if !data.has_key?(value.to_s) && !data.has_key?(value.to_sym)
|
10
10
|
message = "The property '#{build_fragment(fragments)}' has a property '#{property}' that depends on a missing property '#{value}'"
|
11
11
|
validation_error(processor, message, fragments, current_schema, self, options[:record_errors])
|
12
12
|
end
|
@@ -10,18 +10,18 @@ module JSON
|
|
10
10
|
!property_schema['readonly'] &&
|
11
11
|
options[:insert_defaults]
|
12
12
|
default = property_schema['default']
|
13
|
-
data[property] = (default.is_a?(Hash) ? default.clone : default)
|
13
|
+
data[property.to_s] = (default.is_a?(Hash) ? default.clone : default)
|
14
14
|
end
|
15
15
|
|
16
|
-
if property_schema['required'] && !data.has_key?(property.to_s)
|
16
|
+
if property_schema['required'] && !data.has_key?(property.to_s) && !data.has_key?(property.to_sym)
|
17
17
|
message = "The property '#{build_fragment(fragments)}' did not contain a required property of '#{property}'"
|
18
18
|
validation_error(processor, message, fragments, current_schema, self, options[:record_errors])
|
19
19
|
end
|
20
20
|
|
21
21
|
if data.has_key?(property.to_s) || data.has_key?(property.to_sym)
|
22
22
|
schema = JSON::Schema.new(property_schema,current_schema.uri,validator)
|
23
|
-
fragments << property
|
24
|
-
schema.validate(data[property],fragments,processor,options)
|
23
|
+
fragments << property.to_s
|
24
|
+
schema.validate(data[property.to_s],fragments,processor,options)
|
25
25
|
fragments.pop
|
26
26
|
end
|
27
27
|
end
|
@@ -10,13 +10,13 @@ module JSON
|
|
10
10
|
!property_schema['readonly'] &&
|
11
11
|
options[:insert_defaults]
|
12
12
|
default = property_schema['default']
|
13
|
-
data[property] = (default.is_a?(Hash) ? default.clone : default)
|
13
|
+
data[property.to_s] = (default.is_a?(Hash) ? default.clone : default)
|
14
14
|
end
|
15
15
|
|
16
|
-
if data.has_key?(property.to_s)
|
16
|
+
if data.has_key?(property.to_s) || data.has_key?(property.to_sym)
|
17
17
|
schema = JSON::Schema.new(property_schema,current_schema.uri,validator)
|
18
|
-
fragments << property
|
19
|
-
schema.validate(data[property],fragments,processor,options)
|
18
|
+
fragments << property.to_s
|
19
|
+
schema.validate(data[property.to_s],fragments,processor,options)
|
20
20
|
fragments.pop
|
21
21
|
end
|
22
22
|
end
|
data/test/test_ruby_schema.rb
CHANGED