Skip to content

Commit ebc90bb

Browse files
committed
Merge commit '8fcfc3a674a7188a4fcc822b7a91efb3e0422a20'
* commit '8fcfc3a674a7188a4fcc822b7a91efb3e0422a20': Squashed 'json/' changes from b41167c74..54f3784a8
2 parents 30b7537 + 8fcfc3a commit ebc90bb

36 files changed

+689
-747
lines changed

json/remotes/draft-next/format-assertion-false.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/next/vocab/core": true,
66
"https://json-schema.org/draft/next/vocab/format-assertion": false
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/next/meta/core" },
1011
{ "$ref": "https://json-schema.org/draft/next/meta/format-assertion" }

json/remotes/draft-next/format-assertion-true.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/next/vocab/core": true,
66
"https://json-schema.org/draft/next/vocab/format-assertion": true
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/next/meta/core" },
1011
{ "$ref": "https://json-schema.org/draft/next/meta/format-assertion" }

json/remotes/draft-next/metaschema-no-validation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/next/vocab/applicator": true,
66
"https://json-schema.org/draft/next/vocab/core": true
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/next/meta/applicator" },
1011
{ "$ref": "https://json-schema.org/draft/next/meta/core" }

json/remotes/draft-next/metaschema-optional-vocabulary.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"https://json-schema.org/draft/next/vocab/core": true,
77
"http://localhost:1234/draft/next/vocab/custom": false
88
},
9+
"$dynamicAnchor": "meta",
910
"allOf": [
1011
{ "$ref": "https://json-schema.org/draft/next/meta/validation" },
1112
{ "$ref": "https://json-schema.org/draft/next/meta/core" }

json/remotes/draft2019-09/metaschema-no-validation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
66
"https://json-schema.org/draft/2019-09/vocab/core": true
77
},
8+
"$recursiveAnchor": true,
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/2019-09/meta/applicator" },
1011
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }

json/remotes/draft2019-09/metaschema-optional-vocabulary.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"https://json-schema.org/draft/2019-09/vocab/core": true,
77
"http://localhost:1234/draft/2019-09/vocab/custom": false
88
},
9+
"$recursiveAnchor": true,
910
"allOf": [
1011
{ "$ref": "https://json-schema.org/draft/2019-09/meta/validation" },
1112
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }

json/remotes/draft2020-12/format-assertion-false.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/2020-12/vocab/core": true,
66
"https://json-schema.org/draft/2020-12/vocab/format-assertion": false
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" },
1011
{ "$ref": "https://json-schema.org/draft/2020-12/meta/format-assertion" }

json/remotes/draft2020-12/format-assertion-true.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/2020-12/vocab/core": true,
66
"https://json-schema.org/draft/2020-12/vocab/format-assertion": true
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" },
1011
{ "$ref": "https://json-schema.org/draft/2020-12/meta/format-assertion" }

json/remotes/draft2020-12/metaschema-no-validation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
66
"https://json-schema.org/draft/2020-12/vocab/core": true
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/2020-12/meta/applicator" },
1011
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }

json/remotes/draft2020-12/metaschema-optional-vocabulary.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"https://json-schema.org/draft/2020-12/vocab/core": true,
77
"http://localhost:1234/draft/2020-12/vocab/custom": false
88
},
9+
"$dynamicAnchor": "meta",
910
"allOf": [
1011
{ "$ref": "https://json-schema.org/draft/2020-12/meta/validation" },
1112
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }

json/test-schema.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,69 @@
2727
"type": "array",
2828
"items": { "$ref": "#/$defs/test" },
2929
"minItems": 1
30+
},
31+
"specification":{
32+
"description": "A reference to a specification document which defines the behavior tested by this test case. Typically this should be a JSON Schema specification document, though in cases where the JSON Schema specification points to another RFC it should contain *both* the portion of the JSON Schema specification which indicates what RFC (and section) to follow as *well* as information on where in that specification the behavior is specified.",
33+
34+
"type": "array",
35+
"minItems": 1,
36+
"uniqueItems": true,
37+
"items":{
38+
"properties": {
39+
"core": {
40+
"description": "A section in official JSON Schema core drafts",
41+
"url": "https://json-schema.org/specification-links",
42+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
43+
"type":"string"
44+
},
45+
"validation": {
46+
"description": "A section in official JSON Schema validation drafts",
47+
"url": "https://json-schema.org/specification-links",
48+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
49+
"type":"string"
50+
},
51+
"ecma262": {
52+
"description": "A section in official ECMA 262 specification for defining regular expressions",
53+
"url": "https://262.ecma-international.org/",
54+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
55+
"type":"string"
56+
},
57+
"perl5": {
58+
"description": "A section name in Perl documentation for defining regular expressions",
59+
"url": "https://perldoc.perl.org/perlre",
60+
"type":"string"
61+
},
62+
"quote": {
63+
"description": "Quote describing the test case",
64+
"type":"string"
65+
}
66+
},
67+
"patternProperties": {
68+
"^rfc\\d+$": {
69+
"description": "A section in official RFC for the given rfc number",
70+
"url": "https://www.rfc-editor.org/",
71+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
72+
"type":"string"
73+
},
74+
"^iso\\d+$": {
75+
"description": "A section in official ISO for the given iso number",
76+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
77+
"type": "string"
78+
}
79+
},
80+
"additionalProperties": { "type": "string" },
81+
"minProperties": 1,
82+
"propertyNames": {
83+
"oneOf": [
84+
{
85+
"pattern": "^((iso)|(rfc))[0-9]+$"
86+
},
87+
{
88+
"enum": [ "core", "validation", "ecma262", "perl5", "quote" ]
89+
}
90+
]
91+
}
92+
}
3093
}
3194
},
3295
"additionalProperties": false

json/tests/draft-next/additionalProperties.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,97 @@
152152
"valid": true
153153
}
154154
]
155+
},
156+
{
157+
"description": "additionalProperties with propertyNames",
158+
"schema": {
159+
"$schema": "https://json-schema.org/draft/next/schema",
160+
"propertyNames": {
161+
"maxLength": 5
162+
},
163+
"additionalProperties": {
164+
"type": "number"
165+
}
166+
},
167+
"tests": [
168+
{
169+
"description": "Valid against both keywords",
170+
"data": { "apple": 4 },
171+
"valid": true
172+
},
173+
{
174+
"description": "Valid against propertyNames, but not additionalProperties",
175+
"data": { "fig": 2, "pear": "available" },
176+
"valid": false
177+
}
178+
]
179+
},
180+
{
181+
"description": "propertyDependencies with additionalProperties",
182+
"schema": {
183+
"$schema": "https://json-schema.org/draft/next/schema",
184+
"properties" : {"foo2" : {}},
185+
"propertyDependencies": {
186+
"foo" : {},
187+
"foo2": {
188+
"bar": {
189+
"properties": {
190+
"buz": {}
191+
}
192+
}
193+
}
194+
},
195+
"additionalProperties": false
196+
},
197+
"tests": [
198+
{
199+
"description": "additionalProperties doesn't consider propertyDependencies properties" ,
200+
"data": {"foo": ""},
201+
"valid": false
202+
},
203+
{
204+
"description": "additionalProperties can't see buz even when foo2 is present",
205+
"data": {"foo2": "bar", "buz": ""},
206+
"valid": false
207+
},
208+
{
209+
"description": "additionalProperties can't see buz",
210+
"data": {"buz": ""},
211+
"valid": false
212+
}
213+
]
214+
},
215+
{
216+
"description": "dependentSchemas with additionalProperties",
217+
"schema": {
218+
"$schema": "https://json-schema.org/draft/next/schema",
219+
"properties": {"foo2": {}},
220+
"dependentSchemas": {
221+
"foo": {},
222+
"foo2": {
223+
"properties": {
224+
"bar": {}
225+
}
226+
}
227+
},
228+
"additionalProperties": false
229+
},
230+
"tests": [
231+
{
232+
"description": "additionalProperties doesn't consider dependentSchemas",
233+
"data": {"foo": ""},
234+
"valid": false
235+
},
236+
{
237+
"description": "additionalProperties can't see bar",
238+
"data": {"bar": ""},
239+
"valid": false
240+
},
241+
{
242+
"description": "additionalProperties can't see bar even when foo2 is present",
243+
"data": {"foo2": "", "bar": ""},
244+
"valid": false
245+
}
246+
]
155247
}
156248
]

json/tests/draft-next/anchor.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -116,29 +116,5 @@
116116
"valid": false
117117
}
118118
]
119-
},
120-
{
121-
"description": "invalid anchors",
122-
"schema": {
123-
"$schema": "https://json-schema.org/draft/next/schema",
124-
"$ref": "https://json-schema.org/draft/next/schema"
125-
},
126-
"tests": [
127-
{
128-
"description": "MUST start with a letter (and not #)",
129-
"data": { "$anchor" : "#foo" },
130-
"valid": false
131-
},
132-
{
133-
"description": "JSON pointers are not valid",
134-
"data": { "$anchor" : "/a/b" },
135-
"valid": false
136-
},
137-
{
138-
"description": "invalid with valid beginning",
139-
"data": { "$anchor" : "foo#something" },
140-
"valid": false
141-
}
142-
]
143119
}
144120
]

json/tests/draft-next/dynamicRef.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,5 +642,60 @@
642642
"valid": false
643643
}
644644
]
645+
},
646+
{
647+
"description": "$dynamicRef skips over intermediate resources - direct reference",
648+
"schema": {
649+
"$schema": "https://json-schema.org/draft/next/schema",
650+
"$id": "https://test.json-schema.org/dynamic-ref-skips-intermediate-resource/main",
651+
"type": "object",
652+
"properties": {
653+
"bar-item": {
654+
"$ref": "item"
655+
}
656+
},
657+
"$defs": {
658+
"bar": {
659+
"$id": "bar",
660+
"type": "array",
661+
"items": {
662+
"$ref": "item"
663+
},
664+
"$defs": {
665+
"item": {
666+
"$id": "item",
667+
"type": "object",
668+
"properties": {
669+
"content": {
670+
"$dynamicRef": "#content"
671+
}
672+
},
673+
"$defs": {
674+
"defaultContent": {
675+
"$dynamicAnchor": "content",
676+
"type": "integer"
677+
}
678+
}
679+
},
680+
"content": {
681+
"$dynamicAnchor": "content",
682+
"type": "string"
683+
}
684+
}
685+
}
686+
}
687+
},
688+
"tests": [
689+
{
690+
"description": "integer property passes",
691+
"data": { "bar-item": { "content": 42 } },
692+
"valid": true
693+
},
694+
{
695+
"description": "string property fails",
696+
"data": { "bar-item": { "content": "value" } },
697+
"valid": false
698+
}
699+
]
645700
}
646701
]

0 commit comments

Comments
 (0)