Skip to content

Commit cbe0e5b

Browse files
committed
Merge branch 'master' into ref-tests
2 parents 3186761 + 8758156 commit cbe0e5b

31 files changed

+827
-63
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
JSON Schema Test Suite [![Build Status](https://travis-ci.org/json-schema/JSON-Schema-Test-Suite.png?branch=develop)](https://travis-ci.org/json-schema/JSON-Schema-Test-Suite)
1+
JSON Schema Test Suite [![Build Status](https://travis-ci.org/json-schema-org/JSON-Schema-Test-Suite.png?branch=develop)](https://travis-ci.org/json-schema-org/JSON-Schema-Test-Suite)
22
======================
33

44
This repository contains a set of JSON objects that implementors of JSON Schema
@@ -112,13 +112,14 @@ This suite is being used by:
112112
* [z-schema](https://github.com/zaggino/z-schema)
113113
* [jsen](https://github.com/bugventure/jsen)
114114
* [ajv](https://github.com/epoberezkin/ajv)
115+
* [djv](https://github.com/korzio/djv)
115116

116117
### Node.js ###
117118

118119
The JSON Schema Test Suite is also available as an
119120
[npm](https://www.npmjs.com/package/json-schema-test-suite) package.
120-
Node-specific support is maintained on the [node branch](https://github.com/json-schema/JSON-Schema-Test-Suite/tree/node).
121-
See [NODE-README.md](https://github.com/json-schema/JSON-Schema-Test-Suite/blob/node/NODE-README.md)
121+
Node-specific support is maintained on the [node branch](https://github.com/json-schema-org/JSON-Schema-Test-Suite/tree/node).
122+
See [NODE-README.md](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/node/NODE-README.md)
122123
for more information.
123124

124125
### .NET ###

test-schema.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
{
2-
"$schema": "http://json-schema.org/draft-03/schema#",
2+
"$schema": "http://json-schema.org/draft-04/schema#",
33
"type": "array",
44
"items": {
55
"type": "object",
6+
"required": ["description", "schema", "tests"],
67
"properties": {
7-
"description": {"type": "string", "required": true},
8-
"schema": {"required": true},
8+
"description": {"type": "string"},
9+
"schema": {},
910
"tests": {
1011
"type": "array",
1112
"items": {
1213
"type": "object",
14+
"required": ["description", "data", "valid"],
1315
"properties": {
14-
"description": {"type": "string", "required": true},
15-
"data": {"required": true},
16-
"valid": {"type": "boolean", "required": true}
16+
"description": {"type": "string"},
17+
"data": {},
18+
"valid": {"type": "boolean"}
1719
},
1820
"additionalProperties": false
1921
},

tests/draft3/optional/format.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@
7878
"valid": true
7979
},
8080
{
81-
"description": "a valid protocol-relative URI",
81+
"description": "an invalid protocol-relative URI Reference",
8282
"data": "//foo.bar/?baz=qux#quux",
83-
"valid": true
83+
"valid": false
8484
},
8585
{
8686
"description": "an invalid URI",

tests/draft4/additionalItems.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@
4040
},
4141
"tests": [
4242
{
43-
"description": "no additional items present",
43+
"description": "fewer number of items present",
44+
"data": [ 1, 2 ],
45+
"valid": true
46+
},
47+
{
48+
"description": "equal number of items present",
4449
"data": [ 1, 2, 3 ],
4550
"valid": true
4651
},

tests/draft4/items.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
"description": "ignores non-arrays",
2020
"data": {"foo" : "bar"},
2121
"valid": true
22+
},
23+
{
24+
"description": "JavaScript pseudo-array is valid",
25+
"data": {
26+
"0": "invalid",
27+
"length": 1
28+
},
29+
"valid": true
2230
}
2331
]
2432
},
@@ -55,6 +63,15 @@
5563
"description": "empty array",
5664
"data": [ ],
5765
"valid": true
66+
},
67+
{
68+
"description": "JavaScript pseudo-array is valid",
69+
"data": {
70+
"0": "invalid",
71+
"1": "valid",
72+
"length": 2
73+
},
74+
"valid": true
5875
}
5976
]
6077
}

tests/draft4/maximum.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"data": 2.6,
99
"valid": true
1010
},
11+
{
12+
"description": "boundary point is valid",
13+
"data": 3.0,
14+
"valid": true
15+
},
1116
{
1217
"description": "above the maximum is invalid",
1318
"data": 3.5,

tests/draft4/minimum.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"data": 2.6,
99
"valid": true
1010
},
11+
{
12+
"description": "boundary point is valid",
13+
"data": 1.1,
14+
"valid": true
15+
},
1116
{
1217
"description": "below the minimum is invalid",
1318
"data": 0.6,

tests/draft4/optional/format.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"valid": true
3131
},
3232
{
33-
"description": "a valid protocol-relative URI",
33+
"description": "an invalid protocol-relative URI Reference",
3434
"data": "//foo.bar/?baz=qux#quux",
35-
"valid": true
35+
"valid": false
3636
},
3737
{
3838
"description": "an invalid URI",

tests/draft6/additionalItems.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@
4040
},
4141
"tests": [
4242
{
43-
"description": "no additional items present",
43+
"description": "fewer number of items present",
44+
"data": [ 1, 2 ],
45+
"valid": true
46+
},
47+
{
48+
"description": "equal number of items present",
4449
"data": [ 1, 2, 3 ],
4550
"valid": true
4651
},

tests/draft6/allOf.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,38 @@
108108
"valid": false
109109
}
110110
]
111+
},
112+
{
113+
"description": "allOf with boolean schemas, all true",
114+
"schema": {"allOf": [true, true]},
115+
"tests": [
116+
{
117+
"description": "any value is valid",
118+
"data": "foo",
119+
"valid": true
120+
}
121+
]
122+
},
123+
{
124+
"description": "allOf with boolean schemas, some false",
125+
"schema": {"allOf": [true, false]},
126+
"tests": [
127+
{
128+
"description": "any value is invalid",
129+
"data": "foo",
130+
"valid": false
131+
}
132+
]
133+
},
134+
{
135+
"description": "allOf with boolean schemas, all false",
136+
"schema": {"allOf": [false, false]},
137+
"tests": [
138+
{
139+
"description": "any value is invalid",
140+
"data": "foo",
141+
"valid": false
142+
}
143+
]
111144
}
112145
]

tests/draft6/anyOf.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,38 @@
6464
"valid": false
6565
}
6666
]
67+
},
68+
{
69+
"description": "anyOf with boolean schemas, all true",
70+
"schema": {"anyOf": [true, true]},
71+
"tests": [
72+
{
73+
"description": "any value is valid",
74+
"data": "foo",
75+
"valid": true
76+
}
77+
]
78+
},
79+
{
80+
"description": "anyOf with boolean schemas, some true",
81+
"schema": {"anyOf": [true, false]},
82+
"tests": [
83+
{
84+
"description": "any value is valid",
85+
"data": "foo",
86+
"valid": true
87+
}
88+
]
89+
},
90+
{
91+
"description": "anyOf with boolean schemas, all false",
92+
"schema": {"anyOf": [false, false]},
93+
"tests": [
94+
{
95+
"description": "any value is invalid",
96+
"data": "foo",
97+
"valid": false
98+
}
99+
]
67100
}
68101
]

tests/draft6/boolean_schema.json

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
[
2+
{
3+
"description": "boolean schema 'true'",
4+
"schema": true,
5+
"tests": [
6+
{
7+
"description": "number is valid",
8+
"data": 1,
9+
"valid": true
10+
},
11+
{
12+
"description": "string is valid",
13+
"data": "foo",
14+
"valid": true
15+
},
16+
{
17+
"description": "boolean true is valid",
18+
"data": true,
19+
"valid": true
20+
},
21+
{
22+
"description": "boolean false is valid",
23+
"data": false,
24+
"valid": true
25+
},
26+
{
27+
"description": "null is valid",
28+
"data": null,
29+
"valid": true
30+
},
31+
{
32+
"description": "object is valid",
33+
"data": {"foo": "bar"},
34+
"valid": true
35+
},
36+
{
37+
"description": "empty object is valid",
38+
"data": {},
39+
"valid": true
40+
},
41+
{
42+
"description": "array is valid",
43+
"data": ["foo"],
44+
"valid": true
45+
},
46+
{
47+
"description": "empty array is valid",
48+
"data": [],
49+
"valid": true
50+
}
51+
]
52+
},
53+
{
54+
"description": "boolean schema 'false'",
55+
"schema": false,
56+
"tests": [
57+
{
58+
"description": "number is invalid",
59+
"data": 1,
60+
"valid": false
61+
},
62+
{
63+
"description": "string is invalid",
64+
"data": "foo",
65+
"valid": false
66+
},
67+
{
68+
"description": "boolean true is invalid",
69+
"data": true,
70+
"valid": false
71+
},
72+
{
73+
"description": "boolean false is invalid",
74+
"data": false,
75+
"valid": false
76+
},
77+
{
78+
"description": "null is invalid",
79+
"data": null,
80+
"valid": false
81+
},
82+
{
83+
"description": "object is invalid",
84+
"data": {"foo": "bar"},
85+
"valid": false
86+
},
87+
{
88+
"description": "empty object is invalid",
89+
"data": {},
90+
"valid": false
91+
},
92+
{
93+
"description": "array is invalid",
94+
"data": ["foo"],
95+
"valid": false
96+
},
97+
{
98+
"description": "empty array is invalid",
99+
"data": [],
100+
"valid": false
101+
}
102+
]
103+
}
104+
]

0 commit comments

Comments
 (0)