1[
2 {
3 "description": "object properties validation",
4 "schema": {
5 "properties": {
6 "foo": {"type": "integer"},
7 "bar": {"type": "string"}
8 }
9 },
10 "tests": [
11 {
12 "description": "both properties present and valid is valid",
13 "data": {"foo": 1, "bar": "baz"},
14 "valid": true
15 },
16 {
17 "description": "one property invalid is invalid",
18 "data": {"foo": 1, "bar": {}},
19 "valid": false
20 },
21 {
22 "description": "both properties invalid is invalid",
23 "data": {"foo": [], "bar": {}},
24 "valid": false
25 },
26 {
27 "description": "doesn't invalidate other properties",
28 "data": {"quux": []},
29 "valid": true
30 },
31 {
32 "description": "ignores arrays",
33 "data": [],
34 "valid": true
35 },
36 {
37 "description": "ignores other non-objects",
38 "data": 12,
39 "valid": true
40 }
41 ]
42 },
43 {
44 "description":
45 "properties, patternProperties, additionalProperties interaction",
46 "schema": {
47 "properties": {
48 "foo": {"type": "array", "maxItems": 3},
49 "bar": {"type": "array"}
50 },
51 "patternProperties": {"f.o": {"minItems": 2}},
52 "additionalProperties": {"type": "integer"}
53 },
54 "tests": [
55 {
56 "description": "property validates property",
57 "data": {"foo": [1, 2]},
58 "valid": true
59 },
60 {
61 "description": "property invalidates property",
62 "data": {"foo": [1, 2, 3, 4]},
63 "valid": false
64 },
65 {
66 "description": "patternProperty invalidates property",
67 "data": {"foo": []},
68 "valid": false
69 },
70 {
71 "description": "patternProperty validates nonproperty",
72 "data": {"fxo": [1, 2]},
73 "valid": true
74 },
75 {
76 "description": "patternProperty invalidates nonproperty",
77 "data": {"fxo": []},
78 "valid": false
79 },
80 {
81 "description": "additionalProperty ignores property",
82 "data": {"bar": []},
83 "valid": true
84 },
85 {
86 "description": "additionalProperty validates others",
87 "data": {"quux": 3},
88 "valid": true
89 },
90 {
91 "description": "additionalProperty invalidates others",
92 "data": {"quux": "foo"},
93 "valid": false
94 }
95 ]
96 }
97]
View as plain text