Skip to content

Commit 4f9d0ba

Browse files
authored
Merge pull request #656 from handrews/uneval
Add "unevaluatedProperties" and "unevaluatedItems"
2 parents 41cb6a3 + a71aa68 commit 4f9d0ba

File tree

1 file changed

+117
-4
lines changed

1 file changed

+117
-4
lines changed

jsonschema-core.xml

Lines changed: 117 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,16 +1394,25 @@
13941394
<list>
13951395
<t>
13961396
"additionalProperties", whose behavior is defined in terms of
1397-
"properties" and "patternProperties"; and
1397+
"properties" and "patternProperties"
13981398
</t>
13991399
<t>
1400-
"additionalItems", whose behavior is defined in terms of "items".
1400+
"unevaluatedProperties", whose behavior is defined in terms of
1401+
annotations from "properties", "patternProperties",
1402+
"additionalProperties" and itself
1403+
</t>
1404+
<t>
1405+
"additionalItems", whose behavior is defined in terms of "items"
1406+
</t>
1407+
<t>
1408+
"unevaluatedItems", whose behavior is defined in terms of annotations
1409+
from "items", "additionalItems" and itself
14011410
</t>
14021411
</list>
14031412
</t>
14041413
</section>
14051414

1406-
<section title="Keywords for Applying Subschemas in Place">
1415+
<section title="Keywords for Applying Subschemas in Place" anchor="in-place">
14071416
<t>
14081417
These keywords apply subschemas to the same location in the instance
14091418
as the parent schema is being applied. They allow combining
@@ -1641,6 +1650,60 @@
16411650
</t>
16421651
</section>
16431652

1653+
<section title="unevaluatedItems" anchor="unevaluatedItems">
1654+
<t>
1655+
The value of "unevaluatedItems" MUST be a valid JSON Schema.
1656+
</t>
1657+
<t>
1658+
The behavior of this keyword depends on the annotation results of
1659+
adjacent keywords that apply to the instance location being validated.
1660+
Specifically, the annotations from "items" and "additionalItems",
1661+
which can come from those keywords when they are adjacent to the
1662+
"unevaluatedItems" keyword. Those two annotations, as well as
1663+
"unevaluatedItems", can also result from any and all adjacent
1664+
<xref target="in-place">in-place applicator</xref> keywords.
1665+
This includes but is not limited to the in-place applicators
1666+
defined in this document.
1667+
</t>
1668+
<t>
1669+
If an "items" annotation is present, and its annotation result
1670+
is a number, and no "additionalItems" or "unevaluatedItems"
1671+
annotation is present, then validation succeeds if every instance
1672+
element at an index greater than the "items" annotation validates
1673+
against "unevaluatedItems".
1674+
</t>
1675+
<t>
1676+
Otherwise, if any "items", "additionalItems", or "unevaluatedItems"
1677+
annotations are present with a value of boolean true, then
1678+
"unevaluatedItems" MUST be ignored. However, if none of these
1679+
annotations are present, "unevaluatedItems" MUST be applied to
1680+
all locations in the array.
1681+
</t>
1682+
<t>
1683+
This means that "items", "additionalItems", and all in-place applicators
1684+
MUST be evaluated before this keyword can be evaluated. Authors of
1685+
extension keywords MUST NOT define an in-place applicator that would need
1686+
to be evaluated before this keyword.
1687+
</t>
1688+
<t>
1689+
If the "unevaluatedItems" subschema is applied to any
1690+
positions within the instance array, it produces an
1691+
annotation result of boolean true, analogous to the
1692+
single schema behavior of "items". If any "unevaluatedItems"
1693+
keyword from any subschema applied to the same instance
1694+
location produces an annotation value of true, then
1695+
the combined result from these keywords is also true.
1696+
</t>
1697+
<t>
1698+
Omitting this keyword has the same assertion behavior as
1699+
an empty schema.
1700+
</t>
1701+
<t>
1702+
Implementations that do not collect annotations MUST raise an error
1703+
upon encountering this keyword.
1704+
</t>
1705+
</section>
1706+
16441707
<section title="contains">
16451708
<t>
16461709
The value of this keyword MUST be a valid JSON Schema.
@@ -1740,14 +1803,64 @@
17401803
an empty schema.
17411804
</t>
17421805
<t>
1743-
Implementation MAY choose to implement or optimize this keyword
1806+
Implementations MAY choose to implement or optimize this keyword
17441807
in another way that produces the same effect, such as by directly
17451808
checking the names in "properties" and the patterns in
17461809
"patternProperties" against the instance property set.
17471810
Implementations that do not support annotation collection MUST do so.
17481811
</t>
17491812
</section>
17501813

1814+
<section title="unevaluatedProperties" anchor="unevaluatedProperties">
1815+
<t>
1816+
The value of "unevaluatedProperties" MUST be a valid JSON Schema.
1817+
</t>
1818+
<t>
1819+
The behavior of this keyword depends on the annotation results of
1820+
adjacent keywords that apply to the instance location being validated.
1821+
Specifically, the annotations from "properties", "patternProperties",
1822+
and "additionalProperties", which can come from those keywords when
1823+
they are adjacent to the "unevaluatedProperties" keyword. Those
1824+
three annotations, as well as "unevaluatedProperties", can also
1825+
result from any and all adjacent
1826+
<xref target="in-place">in-place applicator</xref> keywords.
1827+
This includes but is not limited to the in-place applicators
1828+
defined in this document.
1829+
</t>
1830+
<t>
1831+
Validation with "unevaluatedProperties" applies only to the child
1832+
values of instance names that do not appear in the "properties",
1833+
"patternProperties", "additionalProperties", or
1834+
"unevaluatedProperties" annotation results that apply to the
1835+
instance location being validated.
1836+
</t>
1837+
<t>
1838+
For all such properties, validation succeeds if the child instance
1839+
validates against the "unevaluatedProperties" schema.
1840+
</t>
1841+
<t>
1842+
This means that "properties", "patternProperties", "additionalProperties",
1843+
and all in-place applicators MUST be evaluated before this keyword can
1844+
be evaluated. Authors of extension keywords MUST NOT define an in-place
1845+
applicator that would need to be evaluated before this keyword.
1846+
</t>
1847+
<t>
1848+
The annotation result of this keyword is the set of instance
1849+
property names validated by this keyword's subschema.
1850+
Annotation results for "unevaluatedProperties" keywords from
1851+
multiple schemas applied to the same instance location are combined
1852+
by taking the union of the sets.
1853+
</t>
1854+
<t>
1855+
Omitting this keyword has the same assertion behavior as
1856+
an empty schema.
1857+
</t>
1858+
<t>
1859+
Implementations that do not collect annotations MUST raise an error
1860+
upon encountering this keyword.
1861+
</t>
1862+
</section>
1863+
17511864
<section title="propertyNames">
17521865
<t>
17531866
The value of "propertyNames" MUST be a valid JSON Schema.

0 commit comments

Comments
 (0)