Skip to content

Commit dd9599a

Browse files
committed
Merge branch 'main' of github.com:json-schema-org/JSON-Schema-Test-Suite
2 parents 5b39343 + 54f3784 commit dd9599a

14 files changed

+317
-11
lines changed

tests/draft-next/additionalProperties.json

+69-1
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,78 @@
171171
"valid": true
172172
},
173173
{
174-
"description": "Valid against propertyNames, but not unevaluatedProperties",
174+
"description": "Valid against propertyNames, but not additionalProperties",
175175
"data": { "fig": 2, "pear": "available" },
176176
"valid": false
177177
}
178178
]
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+
]
179247
}
180248
]

tests/draft-next/oneOf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
}
221221
]
222222
},
223-
{
223+
{
224224
"description": "oneOf with missing optional property",
225225
"schema": {
226226
"$schema": "https://json-schema.org/draft/next/schema",

tests/draft-next/unevaluatedProperties.json

+69
Original file line numberDiff line numberDiff line change
@@ -1603,5 +1603,74 @@
16031603
"valid": false
16041604
}
16051605
]
1606+
},
1607+
{
1608+
"description": "propertyDependencies with unevaluatedProperties" ,
1609+
"schema" : {
1610+
"$schema": "https://json-schema.org/draft/next/schema",
1611+
"properties" : {"foo2" : {}},
1612+
"propertyDependencies": {
1613+
"foo" : {},
1614+
"foo2": {
1615+
"bar": {
1616+
"properties": {
1617+
"buz": {}
1618+
}
1619+
}
1620+
}
1621+
},
1622+
"unevaluatedProperties": false
1623+
},
1624+
1625+
"tests": [
1626+
{
1627+
"description": "unevaluatedProperties doesn't consider propertyDependencies" ,
1628+
"data": {"foo": "bar"},
1629+
"valid": false
1630+
},
1631+
{
1632+
"description": "unevaluatedProperties sees buz when foo2 is present",
1633+
"data": {"foo2": "bar", "buz": ""},
1634+
"valid": true
1635+
},
1636+
{
1637+
"description": "unevaluatedProperties doesn't see buz when foo2 is absent",
1638+
"data": {"buz": ""},
1639+
"valid": false
1640+
}
1641+
]
1642+
},
1643+
{
1644+
"description": "dependentSchemas with unevaluatedProperties",
1645+
"schema": {
1646+
"$schema": "https://json-schema.org/draft/next/schema",
1647+
"properties": {"foo2": {}},
1648+
"dependentSchemas": {
1649+
"foo" : {},
1650+
"foo2": {
1651+
"properties": {
1652+
"bar":{}
1653+
}
1654+
}
1655+
},
1656+
"unevaluatedProperties": false
1657+
},
1658+
"tests": [
1659+
{
1660+
"description": "unevaluatedProperties doesn't consider dependentSchemas",
1661+
"data": {"foo": ""},
1662+
"valid": false
1663+
},
1664+
{
1665+
"description": "unevaluatedProperties doesn't see bar when foo2 is absent",
1666+
"data": {"bar": ""},
1667+
"valid": false
1668+
},
1669+
{
1670+
"description": "unevaluatedProperties sees bar when foo2 is present",
1671+
"data": {"foo2": "", "bar": ""},
1672+
"valid": true
1673+
}
1674+
]
16061675
}
16071676
]

tests/draft2019-09/additionalProperties.json

+34-1
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,43 @@
171171
"valid": true
172172
},
173173
{
174-
"description": "Valid against propertyNames, but not unevaluatedProperties",
174+
"description": "Valid against propertyNames, but not additionalProperties",
175175
"data": { "fig": 2, "pear": "available" },
176176
"valid": false
177177
}
178178
]
179+
},
180+
{
181+
"description": "dependentSchemas with additionalProperties",
182+
"schema": {
183+
"$schema": "https://json-schema.org/draft/2019-09/schema",
184+
"properties": {"foo2": {}},
185+
"dependentSchemas": {
186+
"foo" : {},
187+
"foo2": {
188+
"properties": {
189+
"bar":{}
190+
}
191+
}
192+
},
193+
"additionalProperties": false
194+
},
195+
"tests": [
196+
{
197+
"description": "additionalProperties doesn't consider dependentSchemas",
198+
"data": {"foo": ""},
199+
"valid": false
200+
},
201+
{
202+
"description": "additionalProperties can't see bar",
203+
"data": {"bar": ""},
204+
"valid": false
205+
},
206+
{
207+
"description": "additionalProperties can't see bar even when foo2 is present",
208+
"data": { "foo2": "", "bar": ""},
209+
"valid": false
210+
}
211+
]
179212
}
180213
]

tests/draft2019-09/oneOf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
}
221221
]
222222
},
223-
{
223+
{
224224
"description": "oneOf with missing optional property",
225225
"schema": {
226226
"$schema": "https://json-schema.org/draft/2019-09/schema",

tests/draft2019-09/ref.json

+39-1
Original file line numberDiff line numberDiff line change
@@ -1048,5 +1048,43 @@
10481048
"valid": false
10491049
}
10501050
]
1051-
}
1051+
},
1052+
{
1053+
"description": "$ref with $recursiveAnchor",
1054+
"schema": {
1055+
"$schema": "https://json-schema.org/draft/2019-09/schema",
1056+
"$id": "https://example.com/schemas/unevaluated-items-are-disallowed",
1057+
"$ref": "/schemas/unevaluated-items-are-allowed",
1058+
"$recursiveAnchor": true,
1059+
"unevaluatedItems": false,
1060+
"$defs": {
1061+
"/schemas/unevaluated-items-are-allowed": {
1062+
"$schema": "https://json-schema.org/draft/2019-09/schema",
1063+
"$id": "/schemas/unevaluated-items-are-allowed",
1064+
"$recursiveAnchor": true,
1065+
"type": "array",
1066+
"items": [
1067+
{
1068+
"type": "string"
1069+
},
1070+
{
1071+
"$ref": "#"
1072+
}
1073+
]
1074+
}
1075+
}
1076+
},
1077+
"tests": [
1078+
{
1079+
"description": "extra items allowed for inner arrays",
1080+
"data" : ["foo",["bar" , [] , 8]],
1081+
"valid": true
1082+
},
1083+
{
1084+
"description": "extra items disallowed for root",
1085+
"data" : ["foo",["bar" , [] , 8], 8],
1086+
"valid": false
1087+
}
1088+
]
1089+
}
10521090
]

tests/draft2019-09/unevaluatedProperties.json

+33
Original file line numberDiff line numberDiff line change
@@ -1567,5 +1567,38 @@
15671567
"valid": false
15681568
}
15691569
]
1570+
},
1571+
{
1572+
"description": "dependentSchemas with unevaluatedProperties",
1573+
"schema": {
1574+
"$schema": "https://json-schema.org/draft/2019-09/schema",
1575+
"properties": {"foo2": {}},
1576+
"dependentSchemas": {
1577+
"foo" : {},
1578+
"foo2": {
1579+
"properties": {
1580+
"bar":{}
1581+
}
1582+
}
1583+
},
1584+
"unevaluatedProperties": false
1585+
},
1586+
"tests": [
1587+
{
1588+
"description": "unevaluatedProperties doesn't consider dependentSchemas",
1589+
"data": {"foo": ""},
1590+
"valid": false
1591+
},
1592+
{
1593+
"description": "unevaluatedProperties doesn't see bar when foo2 is absent",
1594+
"data": {"bar": ""},
1595+
"valid": false
1596+
},
1597+
{
1598+
"description": "unevaluatedProperties sees bar when foo2 is present",
1599+
"data": { "foo2": "", "bar": ""},
1600+
"valid": true
1601+
}
1602+
]
15701603
}
15711604
]

tests/draft2020-12/additionalProperties.json

+34-1
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,43 @@
177177
"valid": true
178178
},
179179
{
180-
"description": "Valid against propertyNames, but not unevaluatedProperties",
180+
"description": "Valid against propertyNames, but not additionalProperties",
181181
"data": { "fig": 2, "pear": "available" },
182182
"valid": false
183183
}
184184
]
185+
},
186+
{
187+
"description": "dependentSchemas with additionalProperties",
188+
"schema": {
189+
"$schema": "https://json-schema.org/draft/2020-12/schema",
190+
"properties": {"foo2": {}},
191+
"dependentSchemas": {
192+
"foo" : {},
193+
"foo2": {
194+
"properties": {
195+
"bar": {}
196+
}
197+
}
198+
},
199+
"additionalProperties": false
200+
},
201+
"tests": [
202+
{
203+
"description": "additionalProperties doesn't consider dependentSchemas",
204+
"data": {"foo": ""},
205+
"valid": false
206+
},
207+
{
208+
"description": "additionalProperties can't see bar",
209+
"data": {"bar": ""},
210+
"valid": false
211+
},
212+
{
213+
"description": "additionalProperties can't see bar even when foo2 is present",
214+
"data": {"foo2": "", "bar": ""},
215+
"valid": false
216+
}
217+
]
185218
}
186219
]

tests/draft2020-12/oneOf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
}
221221
]
222222
},
223-
{
223+
{
224224
"description": "oneOf with missing optional property",
225225
"schema": {
226226
"$schema": "https://json-schema.org/draft/2020-12/schema",

tests/draft2020-12/unevaluatedItems.json

-1
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,6 @@
793793
"data": [ "b" ],
794794
"valid": false
795795
}
796-
797796
]
798797
}
799798
]

0 commit comments

Comments
 (0)