1[
2 {
3 "description": "single dependency",
4 "schema": {
5 "dependentSchemas": {
6 "bar": {
7 "properties": {
8 "foo": {"type": "integer"},
9 "bar": {"type": "integer"}
10 }
11 }
12 }
13 },
14 "tests": [
15 {
16 "description": "valid",
17 "data": {"foo": 1, "bar": 2},
18 "valid": true
19 },
20 {
21 "description": "no dependency",
22 "data": {"foo": "quux"},
23 "valid": true
24 },
25 {
26 "description": "wrong type",
27 "data": {"foo": "quux", "bar": 2},
28 "valid": false
29 },
30 {
31 "description": "wrong type other",
32 "data": {"foo": 2, "bar": "quux"},
33 "valid": false
34 },
35 {
36 "description": "wrong type both",
37 "data": {"foo": "quux", "bar": "quux"},
38 "valid": false
39 }
40 ]
41 },
42 {
43 "description": "boolean subschemas",
44 "schema": {
45 "dependentSchemas": {
46 "foo": true,
47 "bar": false
48 }
49 },
50 "tests": [
51 {
52 "description": "object with property having schema true is valid",
53 "data": {"foo": 1},
54 "valid": true
55 },
56 {
57 "description": "object with property having schema false is invalid",
58 "data": {"bar": 2},
59 "valid": false
60 },
61 {
62 "description": "object with both properties is invalid",
63 "data": {"foo": 1, "bar": 2},
64 "valid": false
65 },
66 {
67 "description": "empty object is valid",
68 "data": {},
69 "valid": true
70 }
71 ]
72 },
73 {
74 "description": "dependencies with escaped characters",
75 "schema": {
76 "dependentSchemas": {
77 "foo\tbar": {"minProperties": 4},
78 "foo'bar": {"required": ["foo\"bar"]}
79 }
80 },
81 "tests": [
82 {
83 "description": "quoted tab",
84 "data": {
85 "foo\tbar": 1,
86 "a": 2,
87 "b": 3,
88 "c": 4
89 },
90 "valid": true
91 },
92 {
93 "description": "quoted quote",
94 "data": {
95 "foo'bar": {"foo\"bar": 1}
96 },
97 "valid": false
98 },
99 {
100 "description": "quoted tab invalid under dependent schema",
101 "data": {
102 "foo\tbar": 1,
103 "a": 2
104 },
105 "valid": false
106 },
107 {
108 "description": "quoted quote invalid under dependent schema",
109 "data": {"foo'bar": 1},
110 "valid": false
111 }
112 ]
113 }
114]
View as plain text