json_schema 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/json_schema/validator.rb +2 -2
- data/test/json_schema/validator_test.rb +10 -0
- metadata +2 -2
@@ -406,9 +406,9 @@ module JsonSchema
|
|
406
406
|
return true if schema.properties.empty?
|
407
407
|
valid = true
|
408
408
|
schema.properties.each do |key, subschema|
|
409
|
-
if
|
409
|
+
if data.key?(key)
|
410
410
|
valid = strict_and valid,
|
411
|
-
validate_data(subschema,
|
411
|
+
validate_data(subschema, data[key], errors, path + [key])
|
412
412
|
end
|
413
413
|
end
|
414
414
|
valid
|
@@ -25,6 +25,16 @@ describe JsonSchema::Validator do
|
|
25
25
|
%{Expected data to be a member of enum ["private", "public"], value was: personal.}
|
26
26
|
end
|
27
27
|
|
28
|
+
it "validates enum unsuccessfully with boolean" do
|
29
|
+
pointer("#/definitions/app/definitions/visibility").merge!(
|
30
|
+
"enum" => [true]
|
31
|
+
)
|
32
|
+
data_sample["visibility"] = false
|
33
|
+
refute validate
|
34
|
+
assert_includes error_messages,
|
35
|
+
%{Expected data to be a member of enum [true], value was: false.}
|
36
|
+
end
|
37
|
+
|
28
38
|
it "validates type successfully" do
|
29
39
|
pointer("#/definitions/app").merge!(
|
30
40
|
"type" => ["object"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|