Skip to content

Commit f634f57

Browse files
committed
Add tests for evaluated property nesting conflicts
1 parent 677a939 commit f634f57

File tree

6 files changed

+147
-0
lines changed

6 files changed

+147
-0
lines changed

tests/draft-next/unevaluatedItems.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,5 +819,30 @@
819819
}
820820

821821
]
822+
},
823+
{
824+
"description": "Evaluated items collection needs to consider instance location",
825+
"schema": {
826+
"$schema": "https://json-schema.org/draft/next/schema",
827+
"prefixItems": [
828+
{
829+
"prefixItems": [
830+
true,
831+
{ "type": "string" }
832+
]
833+
}
834+
],
835+
"unevaluatedItems": false
836+
},
837+
"tests": [
838+
{
839+
"description": "The nested second item shouldn't cause the top-level second item to be considered evaluated",
840+
"data": [
841+
["foo", "bar"],
842+
"bar"
843+
],
844+
"valid": false
845+
}
846+
]
822847
}
823848
]

tests/draft-next/unevaluatedProperties.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,5 +1672,29 @@
16721672
"valid": true
16731673
}
16741674
]
1675+
},
1676+
{
1677+
"description": "Evaluated properties collection needs to consider instance location",
1678+
"schema": {
1679+
"$schema": "https://json-schema.org/draft/next/schema",
1680+
"properties": {
1681+
"foo": {
1682+
"properties": {
1683+
"bar": { "type": "string" }
1684+
}
1685+
}
1686+
},
1687+
"unevaluatedProperties": false
1688+
},
1689+
"tests": [
1690+
{
1691+
"description": "The nested 'bar' shouldn't cause the top-level 'bar' to be considered evaluated",
1692+
"data": {
1693+
"foo": { "bar": "foo" },
1694+
"bar": "bar"
1695+
},
1696+
"valid": false
1697+
}
1698+
]
16751699
}
16761700
]

tests/draft2019-09/unevaluatedItems.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,5 +699,30 @@
699699
}
700700

701701
]
702+
},
703+
{
704+
"description": "Evaluated items collection needs to consider instance location",
705+
"schema": {
706+
"$schema": "https://json-schema.org/draft/2019-09/schema",
707+
"prefixItems": [
708+
{
709+
"prefixItems": [
710+
true,
711+
{ "type": "string" }
712+
]
713+
}
714+
],
715+
"unevaluatedItems": false
716+
},
717+
"tests": [
718+
{
719+
"description": "The nested second item shouldn't cause the top-level second item to be considered evaluated",
720+
"data": [
721+
["foo", "bar"],
722+
"bar"
723+
],
724+
"valid": false
725+
}
726+
]
702727
}
703728
]

tests/draft2019-09/unevaluatedProperties.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,5 +1600,29 @@
16001600
"valid": true
16011601
}
16021602
]
1603+
},
1604+
{
1605+
"description": "Evaluated properties collection needs to consider instance location",
1606+
"schema": {
1607+
"$schema": "https://json-schema.org/draft/2019-09/schema",
1608+
"properties": {
1609+
"foo": {
1610+
"properties": {
1611+
"bar": { "type": "string" }
1612+
}
1613+
}
1614+
},
1615+
"unevaluatedProperties": false
1616+
},
1617+
"tests": [
1618+
{
1619+
"description": "The nested 'bar' shouldn't cause the top-level 'bar' to be considered evaluated",
1620+
"data": {
1621+
"foo": { "bar": "foo" },
1622+
"bar": "bar"
1623+
},
1624+
"valid": false
1625+
}
1626+
]
16031627
}
16041628
]

tests/draft2020-12/unevaluatedItems.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,5 +825,30 @@
825825
"valid": false
826826
}
827827
]
828+
},
829+
{
830+
"description": "Evaluated items collection needs to consider instance location",
831+
"schema": {
832+
"$schema": "https://json-schema.org/draft/2020-12/schema",
833+
"prefixItems": [
834+
{
835+
"prefixItems": [
836+
true,
837+
{ "type": "string" }
838+
]
839+
}
840+
],
841+
"unevaluatedItems": false
842+
},
843+
"tests": [
844+
{
845+
"description": "The nested second item shouldn't cause the top-level second item to be considered evaluated",
846+
"data": [
847+
["foo", "bar"],
848+
"bar"
849+
],
850+
"valid": false
851+
}
852+
]
828853
}
829854
]

tests/draft2020-12/unevaluatedProperties.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,5 +1587,29 @@
15871587
"valid": true
15881588
}
15891589
]
1590+
},
1591+
{
1592+
"description": "Evaluated properties collection needs to consider instance location",
1593+
"schema": {
1594+
"$schema": "https://json-schema.org/draft/2020-12/schema",
1595+
"properties": {
1596+
"foo": {
1597+
"properties": {
1598+
"bar": { "type": "string" }
1599+
}
1600+
}
1601+
},
1602+
"unevaluatedProperties": false
1603+
},
1604+
"tests": [
1605+
{
1606+
"description": "The nested 'bar' shouldn't cause the top-level 'bar' to be considered evaluated",
1607+
"data": {
1608+
"foo": { "bar": "foo" },
1609+
"bar": "bar"
1610+
},
1611+
"valid": false
1612+
}
1613+
]
15901614
}
15911615
]

0 commit comments

Comments
 (0)