1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
[
{
"description": "uniqueItems validation",
"schema": {"uniqueItems": true},
"tests": [
{
"description": "unique array of integers is valid",
"data": [1, 2],
"valid": true
},
{
"description": "non-unique array of integers is invalid",
"data": [1, 1],
"valid": false
},
{
"description": "numbers are unique if mathematically unequal",
"data": [1.0, 1.00, 1],
"valid": false
},
{
"description": "false is not equal to zero",
"data": [0, false],
"valid": true
},
{
"description": "true is not equal to one",
"data": [1, true],
"valid": true
},
{
"description": "unique array of objects is valid",
"data": [{"foo": "bar"}, {"foo": "baz"}],
"valid": true
},
{
"description": "non-unique array of objects is invalid",
"data": [{"foo": "bar"}, {"foo": "bar"}],
"valid": false
},
{
"description": "unique array of nested objects is valid",
"data": [
{"foo": {"bar" : {"baz" : true}}},
{"foo": {"bar" : {"baz" : false}}}
],
"valid": true
},
{
"description": "non-unique array of nested objects is invalid",
"data": [
{"foo": {"bar" : {"baz" : true}}},
{"foo": {"bar" : {"baz" : true}}}
],
"valid": false
},
{
"description": "unique array of arrays is valid",
"data": [["foo"], ["bar"]],
"valid": true
},
{
"description": "non-unique array of arrays is invalid",
"data": [["foo"], ["foo"]],
"valid": false
},
{
"description": "1 and true are unique",
"data": [1, true],
"valid": true
},
{
"description": "0 and false are unique",
"data": [0, false],
"valid": true
},
{
"description": "unique heterogeneous types are valid",
"data": [{}, [1], true, null, 1],
"valid": true
},
{
"description": "non-unique heterogeneous types are invalid",
"data": [{}, [1], true, null, {}, 1],
"valid": false
}
]
},
{
"description": "uniqueItems with an array of items",
"schema": {
"items": [{"type": "boolean"}, {"type": "boolean"}],
"uniqueItems": true
},
"tests": [
{
"description": "[false, true] from items array is valid",
"data": [false, true],
"valid": true
},
{
"description": "[true, false] from items array is valid",
"data": [true, false],
"valid": true
},
{
"description": "[false, false] from items array is not valid",
"data": [false, false],
"valid": false
},
{
"description": "[true, true] from items array is not valid",
"data": [true, true],
"valid": false
},
{
"description": "unique array extended from [false, true] is valid",
"data": [false, true, "foo", "bar"],
"valid": true
},
{
"description": "unique array extended from [true, false] is valid",
"data": [true, false, "foo", "bar"],
"valid": true
},
{
"description": "non-unique array extended from [false, true] is not valid",
"data": [false, true, "foo", "foo"],
"valid": false
},
{
"description": "non-unique array extended from [true, false] is not valid",
"data": [true, false, "foo", "foo"],
"valid": false
}
]
},
{
"description": "uniqueItems with an array of items and additionalItems=false",
"schema": {
"items": [{"type": "boolean"}, {"type": "boolean"}],
"uniqueItems": true,
"additionalItems": false
},
"tests": [
{
"description": "[false, true] from items array is valid",
"data": [false, true],
"valid": true
},
{
"description": "[true, false] from items array is valid",
"data": [true, false],
"valid": true
},
{
"description": "[false, false] from items array is not valid",
"data": [false, false],
"valid": false
},
{
"description": "[true, true] from items array is not valid",
"data": [true, true],
"valid": false
},
{
"description": "extra items are invalid even if unique",
"data": [false, true, null],
"valid": false
}
]
}
]
|