Skip to content

Commit ea48512

Browse files
authored
Merge branch 'json-schema-org:main' into main
2 parents 3b5782b + 64a3e7b commit ea48512

File tree

7 files changed

+294
-0
lines changed

7 files changed

+294
-0
lines changed

tests/draft-next/additionalProperties.json

+24
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,29 @@
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 unevaluatedProperties",
175+
"data": { "fig": 2, "pear": "available" },
176+
"valid": false
177+
}
178+
]
155179
}
156180
]

tests/draft-next/dynamicRef.json

+55
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
]
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[
2+
{
3+
"description": "$dynamicRef skips over intermediate resources - pointer reference across resource boundary",
4+
"schema": {
5+
"$schema": "https://json-schema.org/draft/next/schema",
6+
"$id": "https://test.json-schema.org/dynamic-ref-skips-intermediate-resource/optional/main",
7+
"type": "object",
8+
"properties": {
9+
"bar-item": {
10+
"$ref": "bar#/$defs/item"
11+
}
12+
},
13+
"$defs": {
14+
"bar": {
15+
"$id": "bar",
16+
"type": "array",
17+
"items": {
18+
"$ref": "item"
19+
},
20+
"$defs": {
21+
"item": {
22+
"$id": "item",
23+
"type": "object",
24+
"properties": {
25+
"content": {
26+
"$dynamicRef": "#content"
27+
}
28+
},
29+
"$defs": {
30+
"defaultContent": {
31+
"$dynamicAnchor": "content",
32+
"type": "integer"
33+
}
34+
}
35+
},
36+
"content": {
37+
"$dynamicAnchor": "content",
38+
"type": "string"
39+
}
40+
}
41+
}
42+
}
43+
},
44+
"tests": [
45+
{
46+
"description": "integer property passes",
47+
"data": { "bar-item": { "content": 42 } },
48+
"valid": true
49+
},
50+
{
51+
"description": "string property fails",
52+
"data": { "bar-item": { "content": "value" } },
53+
"valid": false
54+
}
55+
]
56+
}]

tests/draft2019-09/additionalProperties.json

+24
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,29 @@
152152
"valid": true
153153
}
154154
]
155+
},
156+
{
157+
"description": "additionalProperties with propertyNames",
158+
"schema": {
159+
"$schema": "https://json-schema.org/draft/2019-09/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 unevaluatedProperties",
175+
"data": { "fig": 2, "pear": "available" },
176+
"valid": false
177+
}
178+
]
155179
}
156180
]

tests/draft2020-12/additionalProperties.json

+24
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,29 @@
158158
"valid": true
159159
}
160160
]
161+
},
162+
{
163+
"description": "additionalProperties with propertyNames",
164+
"schema": {
165+
"$schema": "https://json-schema.org/draft/2020-12/schema",
166+
"propertyNames": {
167+
"maxLength": 5
168+
},
169+
"additionalProperties": {
170+
"type": "number"
171+
}
172+
},
173+
"tests": [
174+
{
175+
"description": "Valid against both keywords",
176+
"data": { "apple": 4 },
177+
"valid": true
178+
},
179+
{
180+
"description": "Valid against propertyNames, but not unevaluatedProperties",
181+
"data": { "fig": 2, "pear": "available" },
182+
"valid": false
183+
}
184+
]
161185
}
162186
]

tests/draft2020-12/dynamicRef.json

+55
Original file line numberDiff line numberDiff line change
@@ -756,5 +756,60 @@
756756
"valid": false
757757
}
758758
]
759+
},
760+
{
761+
"description": "$dynamicRef skips over intermediate resources - direct reference",
762+
"schema": {
763+
"$schema": "https://json-schema.org/draft/2020-12/schema",
764+
"$id": "https://test.json-schema.org/dynamic-ref-skips-intermediate-resource/main",
765+
"type": "object",
766+
"properties": {
767+
"bar-item": {
768+
"$ref": "item"
769+
}
770+
},
771+
"$defs": {
772+
"bar": {
773+
"$id": "bar",
774+
"type": "array",
775+
"items": {
776+
"$ref": "item"
777+
},
778+
"$defs": {
779+
"item": {
780+
"$id": "item",
781+
"type": "object",
782+
"properties": {
783+
"content": {
784+
"$dynamicRef": "#content"
785+
}
786+
},
787+
"$defs": {
788+
"defaultContent": {
789+
"$dynamicAnchor": "content",
790+
"type": "integer"
791+
}
792+
}
793+
},
794+
"content": {
795+
"$dynamicAnchor": "content",
796+
"type": "string"
797+
}
798+
}
799+
}
800+
}
801+
},
802+
"tests": [
803+
{
804+
"description": "integer property passes",
805+
"data": { "bar-item": { "content": 42 } },
806+
"valid": true
807+
},
808+
{
809+
"description": "string property fails",
810+
"data": { "bar-item": { "content": "value" } },
811+
"valid": false
812+
}
813+
]
759814
}
760815
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[
2+
{
3+
"description": "$dynamicRef skips over intermediate resources - pointer reference across resource boundary",
4+
"schema": {
5+
"$schema": "https://json-schema.org/draft/2020-12/schema",
6+
"$id": "https://test.json-schema.org/dynamic-ref-skips-intermediate-resource/optional/main",
7+
"type": "object",
8+
"properties": {
9+
"bar-item": {
10+
"$ref": "bar#/$defs/item"
11+
}
12+
},
13+
"$defs": {
14+
"bar": {
15+
"$id": "bar",
16+
"type": "array",
17+
"items": {
18+
"$ref": "item"
19+
},
20+
"$defs": {
21+
"item": {
22+
"$id": "item",
23+
"type": "object",
24+
"properties": {
25+
"content": {
26+
"$dynamicRef": "#content"
27+
}
28+
},
29+
"$defs": {
30+
"defaultContent": {
31+
"$dynamicAnchor": "content",
32+
"type": "integer"
33+
}
34+
}
35+
},
36+
"content": {
37+
"$dynamicAnchor": "content",
38+
"type": "string"
39+
}
40+
}
41+
}
42+
}
43+
},
44+
"tests": [
45+
{
46+
"description": "integer property passes",
47+
"data": { "bar-item": { "content": 42 } },
48+
"valid": true
49+
},
50+
{
51+
"description": "string property fails",
52+
"data": { "bar-item": { "content": "value" } },
53+
"valid": false
54+
}
55+
]
56+
}]

0 commit comments

Comments
 (0)