Skip to content

Commit 4ecbea5

Browse files
committed
Squashed 'json/' changes from 54440eab4..ba3a90534
ba3a90534 Merge pull request #523 from olegshtch/extendible-schema-test-suite 458e7ac1e Add test suite to test dynamic reference and anchor link and their independency of order fe405a119 draft/future -> draft/next in $refs also 3d9d35a2a Merge pull request #522 from json-schema-org/ether/draft-next 11b5076f0 rename draft-future to draft-next 0245dcc94 Merge pull request #521 from olegshtch/add-recursive-ref-test-suite e9fb9cf45 Merge pull request #517 from ChALkeR/chalker/date-time-leap f1b230c69 Add test from Appendix C. Example of recursive schema extension of the draft. bb2e37317 Test date-time with leap second on a wrong hour/minute 8b797cfe6 Merge pull request #520 from json-schema-org/ether/custom-dialect 5d23f3112 Add tests for invalid date-time past leap second 63f8e93c1 Improve leap seconds test in optional/format/date-time 3d00f593d test the use of the $vocabulary keyword in a custom metaschema git-subtree-dir: json git-subtree-split: ba3a9053400dd6237aef9cc63601758b1d266818
1 parent cf88638 commit 4ecbea5

File tree

85 files changed

+680
-22
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+680
-22
lines changed

Diff for: remotes/draft2019-09/metaschema-no-validation.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$id": "http://localhost:1234/draft2019-09/metaschema-no-validation.json",
3+
"$vocabulary": {
4+
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
5+
"https://json-schema.org/draft/2019-09/vocab/core": true
6+
},
7+
"allOf": [
8+
{ "$ref": "https://json-schema.org/draft/2019-09/meta/applicator" },
9+
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }
10+
]
11+
}

Diff for: remotes/draft2020-12/metaschema-no-validation.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$id": "http://localhost:1234/draft2020-12/metaschema-no-validation.json",
3+
"$vocabulary": {
4+
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
5+
"https://json-schema.org/draft/2020-12/vocab/core": true
6+
},
7+
"allOf": [
8+
{ "$ref": "https://json-schema.org/draft/2020-12/meta/applicator" },
9+
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }
10+
]
11+
}

Diff for: remotes/extendible-dynamic-ref.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"description": "extendible array",
3+
"$id": "http://localhost:1234/extendible-dynamic-ref.json",
4+
"type": "object",
5+
"properties": {
6+
"elements": {
7+
"type": "array",
8+
"items": {
9+
"$dynamicRef": "#elements"
10+
}
11+
}
12+
},
13+
"required": ["elements"],
14+
"additionalProperties": false,
15+
"$defs": {
16+
"elements": {
17+
"$dynamicAnchor": "elements"
18+
}
19+
}
20+
}

Diff for: remotes/tree.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"description": "tree schema, extensible",
3+
"$id": "http://localhost:1234/tree.json",
4+
"$dynamicAnchor": "node",
5+
6+
"type": "object",
7+
"properties": {
8+
"data": true,
9+
"children": {
10+
"type": "array",
11+
"items": {
12+
"$dynamicRef": "#node"
13+
}
14+
}
15+
}
16+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tests/draft-future/dynamicRef.json renamed to tests/draft-next/dynamicRef.json

+174
Original file line numberDiff line numberDiff line change
@@ -441,5 +441,179 @@
441441
"valid": true
442442
}
443443
]
444+
},
445+
{
446+
"description": "strict-tree schema, guards against misspelled properties",
447+
"schema": {
448+
"$id": "http://localhost:1234/strict-tree.json",
449+
"$dynamicAnchor": "node",
450+
451+
"$ref": "tree.json",
452+
"unevaluatedProperties": false
453+
},
454+
"tests": [
455+
{
456+
"description": "instance with misspelled field",
457+
"data": {
458+
"children": [{
459+
"daat": 1
460+
}]
461+
},
462+
"valid": false
463+
},
464+
{
465+
"description": "instance with correct field",
466+
"data": {
467+
"children": [{
468+
"data": 1
469+
}]
470+
},
471+
"valid": true
472+
}
473+
]
474+
},
475+
{
476+
"description": "tests for implementation dynamic anchor and reference link",
477+
"schema": {
478+
"$id": "http://localhost:1234/strict-extendible.json",
479+
"$ref": "extendible-dynamic-ref.json",
480+
"$defs": {
481+
"elements": {
482+
"$dynamicAnchor": "elements",
483+
"properties": {
484+
"a": true
485+
},
486+
"required": ["a"],
487+
"additionalProperties": false
488+
}
489+
}
490+
},
491+
"tests": [
492+
{
493+
"description": "incorrect parent schema",
494+
"data": {
495+
"a": true
496+
},
497+
"valid": false
498+
},
499+
{
500+
"description": "incorrect extended schema",
501+
"data": {
502+
"elements": [
503+
{ "b": 1 }
504+
]
505+
},
506+
"valid": false
507+
},
508+
{
509+
"description": "correct extended schema",
510+
"data": {
511+
"elements": [
512+
{ "a": 1 }
513+
]
514+
},
515+
"valid": true
516+
}
517+
]
518+
},
519+
{
520+
"description": "Tests for implementation dynamic anchor and reference link. Reference should be independent of any possible ordering.",
521+
"schema": {
522+
"$id": "http://localhost:1234/strict-extendible-allof-defs-first.json",
523+
"allOf": [
524+
{
525+
"$ref": "extendible-dynamic-ref.json"
526+
},
527+
{
528+
"$defs": {
529+
"elements": {
530+
"$dynamicAnchor": "elements",
531+
"properties": {
532+
"a": true
533+
},
534+
"required": ["a"],
535+
"additionalProperties": false
536+
}
537+
}
538+
}
539+
]
540+
},
541+
"tests": [
542+
{
543+
"description": "incorrect parent schema",
544+
"data": {
545+
"a": true
546+
},
547+
"valid": false
548+
},
549+
{
550+
"description": "incorrect extended schema",
551+
"data": {
552+
"elements": [
553+
{ "b": 1 }
554+
]
555+
},
556+
"valid": false
557+
},
558+
{
559+
"description": "correct extended schema",
560+
"data": {
561+
"elements": [
562+
{ "a": 1 }
563+
]
564+
},
565+
"valid": true
566+
}
567+
]
568+
},
569+
{
570+
"description": "Tests for implementation dynamic anchor and reference link. Reference should be independent of any possible ordering.",
571+
"schema": {
572+
"$id": "http://localhost:1234/strict-extendible-allof-ref-first.json",
573+
"allOf": [
574+
{
575+
"$defs": {
576+
"elements": {
577+
"$dynamicAnchor": "elements",
578+
"properties": {
579+
"a": true
580+
},
581+
"required": ["a"],
582+
"additionalProperties": false
583+
}
584+
}
585+
},
586+
{
587+
"$ref": "extendible-dynamic-ref.json"
588+
}
589+
]
590+
},
591+
"tests": [
592+
{
593+
"description": "incorrect parent schema",
594+
"data": {
595+
"a": true
596+
},
597+
"valid": false
598+
},
599+
{
600+
"description": "incorrect extended schema",
601+
"data": {
602+
"elements": [
603+
{ "b": 1 }
604+
]
605+
},
606+
"valid": false
607+
},
608+
{
609+
"description": "correct extended schema",
610+
"data": {
611+
"elements": [
612+
{ "a": 1 }
613+
]
614+
},
615+
"valid": true
616+
}
617+
]
444618
}
445619
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tests/draft-future/id.json renamed to tests/draft-next/id.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"description": "Invalid use of fragments in location-independent $id",
44
"schema": {
5-
"$ref": "https://json-schema.org/draft/future/schema"
5+
"$ref": "https://json-schema.org/draft/next/schema"
66
},
77
"tests": [
88
{
@@ -110,7 +110,7 @@
110110
"description": "Valid use of empty fragments in location-independent $id",
111111
"comment": "These are allowed but discouraged",
112112
"schema": {
113-
"$ref": "https://json-schema.org/draft/future/schema"
113+
"$ref": "https://json-schema.org/draft/next/schema"
114114
},
115115
"tests": [
116116
{
@@ -150,7 +150,7 @@
150150
{
151151
"description": "Unnormalized $ids are allowed but discouraged",
152152
"schema": {
153-
"$ref": "https://json-schema.org/draft/future/schema"
153+
"$ref": "https://json-schema.org/draft/next/schema"
154154
},
155155
"tests": [
156156
{
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tests/draft-future/optional/format/date-time.json renamed to tests/draft-next/optional/format/date-time.json

+28-3
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,38 @@
5454
"valid": true
5555
},
5656
{
57-
"description": "a invalid day in date-time string",
58-
"data": "1990-02-31T15:59:60.123-08:00",
57+
"description": "a valid date-time with a leap second, UTC",
58+
"data": "1998-12-31T23:59:60Z",
59+
"valid": true
60+
},
61+
{
62+
"description": "a valid date-time with a leap second, with minus offset",
63+
"data": "1998-12-31T15:59:60.123-08:00",
64+
"valid": true
65+
},
66+
{
67+
"description": "an invalid date-time past leap second, UTC",
68+
"data": "1998-12-31T23:59:61Z",
69+
"valid": false
70+
},
71+
{
72+
"description": "an invalid date-time with leap second on a wrong minute, UTC",
73+
"data": "1998-12-31T23:58:60Z",
74+
"valid": false
75+
},
76+
{
77+
"description": "an invalid date-time with leap second on a wrong hour, UTC",
78+
"data": "1998-12-31T22:59:60Z",
79+
"valid": false
80+
},
81+
{
82+
"description": "an invalid day in date-time string",
83+
"data": "1990-02-31T15:59:59.123-08:00",
5984
"valid": false
6085
},
6186
{
6287
"description": "an invalid offset in date-time string",
63-
"data": "1990-12-31T15:59:60-24:00",
88+
"data": "1990-12-31T15:59:59-24:00",
6489
"valid": false
6590
},
6691
{
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tests/draft-future/ref.json renamed to tests/draft-next/ref.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
{
179179
"description": "remote ref, containing refs itself",
180180
"schema": {
181-
"$ref": "https://json-schema.org/draft/future/schema"
181+
"$ref": "https://json-schema.org/draft/next/schema"
182182
},
183183
"tests": [
184184
{
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tests/draft-next/vocabulary.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[
2+
{
3+
"description": "schema that uses custom metaschema with with no validation vocabulary",
4+
"schema": {
5+
"$id": "https://schema/using/no/validation",
6+
"$schema": "http://localhost:1234/draft2020-12/metaschema-no-validation.json",
7+
"properties": {
8+
"badProperty": false,
9+
"numberProperty": {
10+
"minimum": 10
11+
}
12+
}
13+
},
14+
"tests": [
15+
{
16+
"description": "applicator vocabulary still works",
17+
"data": {
18+
"badProperty": "this property should not exist"
19+
},
20+
"valid": false
21+
},
22+
{
23+
"description": "no validation: valid number",
24+
"data": 20,
25+
"valid": true
26+
},
27+
{
28+
"description": "no validation: invalid number, but it still validates",
29+
"data": 1,
30+
"valid": true
31+
}
32+
]
33+
}
34+
]

Diff for: tests/draft2019-09/optional/format/date-time.json

+28-3
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,38 @@
5454
"valid": true
5555
},
5656
{
57-
"description": "a invalid day in date-time string",
58-
"data": "1990-02-31T15:59:60.123-08:00",
57+
"description": "a valid date-time with a leap second, UTC",
58+
"data": "1998-12-31T23:59:60Z",
59+
"valid": true
60+
},
61+
{
62+
"description": "a valid date-time with a leap second, with minus offset",
63+
"data": "1998-12-31T15:59:60.123-08:00",
64+
"valid": true
65+
},
66+
{
67+
"description": "an invalid date-time past leap second, UTC",
68+
"data": "1998-12-31T23:59:61Z",
69+
"valid": false
70+
},
71+
{
72+
"description": "an invalid date-time with leap second on a wrong minute, UTC",
73+
"data": "1998-12-31T23:58:60Z",
74+
"valid": false
75+
},
76+
{
77+
"description": "an invalid date-time with leap second on a wrong hour, UTC",
78+
"data": "1998-12-31T22:59:60Z",
79+
"valid": false
80+
},
81+
{
82+
"description": "an invalid day in date-time string",
83+
"data": "1990-02-31T15:59:59.123-08:00",
5984
"valid": false
6085
},
6186
{
6287
"description": "an invalid offset in date-time string",
63-
"data": "1990-12-31T15:59:60-24:00",
88+
"data": "1990-12-31T15:59:59-24:00",
6489
"valid": false
6590
},
6691
{

0 commit comments

Comments
 (0)