Skip to content

Commit cfff411

Browse files
committed
Squashed 'json/' changes from 39d1d24d..1047a1aa
1047a1aa Merge pull request #565 from json-schema-org/update-test-schema 7967a87b Merge pull request #566 from json-schema-org/tidy-unevaluatedItems b45a7878 Remove unnecessary type validation from unevaluatedItems tests. 2b536c02 Update the test schema to Draft 2020, and fix a bug in it. git-subtree-dir: json git-subtree-split: 1047a1aa225bab43c50978555a990bfff81f6023
1 parent 09edc31 commit cfff411

File tree

4 files changed

+41
-165
lines changed

4 files changed

+41
-165
lines changed

test-schema.json

Lines changed: 19 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,57 @@
11
{
2-
"$schema": "http://json-schema.org/draft-06/schema#",
3-
"description": "Schema for tests",
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"description": "A schema for files contained within this suite",
4+
45
"type": "array",
6+
"minItems": 1,
57
"items": {
8+
"description": "An individual test case, containing multiple tests of a single schema's behavior",
9+
610
"type": "object",
711
"required": [ "description", "schema", "tests" ],
812
"properties": {
9-
"id": {
10-
"description": "Uniquely identifies a set of tests",
11-
"type": "string",
12-
"format": "uri"
13-
},
1413
"description": {
15-
"description": "The test set description",
14+
"description": "The test case description",
1615
"type": "string"
1716
},
1817
"comment": {
19-
"description": "Any additional comments about the test set",
18+
"description": "Any additional comments about the test case",
2019
"type": "string"
2120
},
2221
"schema": {
23-
"description": "This should be a valid schema. This should be a ref to a meta-schema if schema keywords need testing."
22+
"description": "A valid JSON Schema (one written for the corresponding version directory that the file sits within)."
2423
},
2524
"tests": {
2625
"description": "A set of related tests all using the same schema",
2726
"type": "array",
28-
"items": { "$ref": "#/definitions/test" },
27+
"items": { "$ref": "#/$defs/test" },
2928
"minItems": 1
3029
}
3130
},
32-
"additionalProperties": false,
33-
"minItems": 1
31+
"additionalProperties": false
3432
},
35-
"definitions": {
36-
"outputItem": {
37-
"type": "object",
38-
"properties": {
39-
"valid": { "type": "boolean" },
40-
"keywordLocation": { "type": "string" },
41-
"absoluteKeywordLocation": {
42-
"type": "string",
43-
"format": "uri"
44-
},
45-
"instanceLocation": { "type": "string" },
46-
"annotations": {
47-
"type": "array",
48-
"items": { "$ref": "#/definitions/outputItem" }
49-
},
50-
"errors": {
51-
"type": "array",
52-
"items": { "$ref": "#/definitions/outputItem" }
53-
}
54-
}
55-
},
33+
34+
"$defs": {
5635
"test": {
5736
"description": "A single test",
37+
5838
"type": "object",
5939
"required": [ "description", "data", "valid" ],
6040
"properties": {
61-
"id": {
62-
"description": "Uniquely identifies a single test",
63-
"type": "string",
64-
"format": "uri"
65-
},
6641
"description": {
67-
"description": "The test description",
42+
"description": "The test description, briefly explaining which behavior it exercises",
6843
"type": "string"
6944
},
7045
"comment": {
7146
"description": "Any additional comments about the test",
7247
"type": "string"
7348
},
7449
"data": {
75-
"description": "This is the instance to be validated against the schema in \"schema\"."
50+
"description": "The instance which should be validated against the schema in \"schema\"."
7651
},
77-
"valid": { "type": "boolean" },
78-
"output": {
79-
"type": "object",
80-
"required": [ "basic", "detailed", "verbose" ],
81-
"properties": {
82-
"basic": { "$ref": "#/definitions/outputItem" },
83-
"detailed": { "$ref": "#/definitions/outputItem" },
84-
"verbose": { "$ref": "#/definitions/outputItem" }
85-
}
52+
"valid": {
53+
"description": "Whether the validation process of this instance should consider the instance valid or not",
54+
"type": "boolean"
8655
}
8756
},
8857
"additionalProperties": false

tests/draft-next/unevaluatedItems.json

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
[
22
{
33
"description": "unevaluatedItems true",
4-
"schema": {
5-
"type": "array",
6-
"unevaluatedItems": true
7-
},
4+
"schema": { "unevaluatedItems": true },
85
"tests": [
96
{
107
"description": "with no unevaluated items",
@@ -20,10 +17,7 @@
2017
},
2118
{
2219
"description": "unevaluatedItems false",
23-
"schema": {
24-
"type": "array",
25-
"unevaluatedItems": false
26-
},
20+
"schema": { "unevaluatedItems": false },
2721
"tests": [
2822
{
2923
"description": "with no unevaluated items",
@@ -39,10 +33,7 @@
3933
},
4034
{
4135
"description": "unevaluatedItems as schema",
42-
"schema": {
43-
"type": "array",
44-
"unevaluatedItems": { "type": "string" }
45-
},
36+
"schema": { "unevaluatedItems": { "type": "string" } },
4637
"tests": [
4738
{
4839
"description": "with no unevaluated items",
@@ -64,7 +55,6 @@
6455
{
6556
"description": "unevaluatedItems with uniform items",
6657
"schema": {
67-
"type": "array",
6858
"items": { "type": "string" },
6959
"unevaluatedItems": false
7060
},
@@ -79,7 +69,6 @@
7969
{
8070
"description": "unevaluatedItems with tuple",
8171
"schema": {
82-
"type": "array",
8372
"prefixItems": [
8473
{ "type": "string" }
8574
],
@@ -101,7 +90,6 @@
10190
{
10291
"description": "unevaluatedItems with items",
10392
"schema": {
104-
"type": "array",
10593
"prefixItems": [
10694
{ "type": "string" }
10795
],
@@ -119,7 +107,6 @@
119107
{
120108
"description": "unevaluatedItems with nested tuple",
121109
"schema": {
122-
"type": "array",
123110
"prefixItems": [
124111
{ "type": "string" }
125112
],
@@ -202,16 +189,13 @@
202189
{
203190
"description": "unevaluatedItems with nested unevaluatedItems",
204191
"schema": {
205-
"type": "array",
206192
"allOf": [
207193
{
208194
"prefixItems": [
209195
{ "type": "string" }
210196
]
211197
},
212-
{
213-
"unevaluatedItems": true
214-
}
198+
{ "unevaluatedItems": true }
215199
],
216200
"unevaluatedItems": false
217201
},
@@ -231,7 +215,6 @@
231215
{
232216
"description": "unevaluatedItems with anyOf",
233217
"schema": {
234-
"type": "array",
235218
"prefixItems": [
236219
{ "const": "foo" }
237220
],
@@ -278,7 +261,6 @@
278261
{
279262
"description": "unevaluatedItems with oneOf",
280263
"schema": {
281-
"type": "array",
282264
"prefixItems": [
283265
{ "const": "foo" }
284266
],
@@ -314,7 +296,6 @@
314296
{
315297
"description": "unevaluatedItems with not",
316298
"schema": {
317-
"type": "array",
318299
"prefixItems": [
319300
{ "const": "foo" }
320301
],
@@ -339,7 +320,6 @@
339320
{
340321
"description": "unevaluatedItems with if/then/else",
341322
"schema": {
342-
"type": "array",
343323
"prefixItems": [
344324
{ "const": "foo" }
345325
],
@@ -392,7 +372,6 @@
392372
{
393373
"description": "unevaluatedItems with boolean schemas",
394374
"schema": {
395-
"type": "array",
396375
"allOf": [true],
397376
"unevaluatedItems": false
398377
},
@@ -412,7 +391,6 @@
412391
{
413392
"description": "unevaluatedItems with $ref",
414393
"schema": {
415-
"type": "array",
416394
"$ref": "#/$defs/bar",
417395
"prefixItems": [
418396
{ "type": "string" }
@@ -447,9 +425,7 @@
447425
{
448426
"prefixItems": [ true ]
449427
},
450-
{
451-
"unevaluatedItems": false
452-
}
428+
{ "unevaluatedItems": false }
453429
]
454430
},
455431
"tests": [
@@ -463,14 +439,10 @@
463439
{
464440
"description": "item is evaluated in an uncle schema to unevaluatedItems",
465441
"schema": {
466-
"type": "object",
467442
"properties": {
468443
"foo": {
469-
"type": "array",
470444
"prefixItems": [
471-
{
472-
"type": "string"
473-
}
445+
{ "type": "string" }
474446
],
475447
"unevaluatedItems": false
476448
}
@@ -481,9 +453,7 @@
481453
"foo": {
482454
"prefixItems": [
483455
true,
484-
{
485-
"type": "string"
486-
}
456+
{ "type": "string" }
487457
]
488458
}
489459
}

0 commit comments

Comments
 (0)