Skip to content

Commit 4050ae4

Browse files
committed
Clarify annotation collection with applicators
In particular, "contains" collects annotations. I'm not sure where the exception came from, as it was not present in the previous draft (to the extent that that draft mentioned annotations). The CREF actually did talk about annotation collection so apparently this was a bit of a muddled mess anyway. This makes "contains" behave like all other applicators, producing both assertion and annotation results.
1 parent 3c08495 commit 4050ae4

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

jsonschema-core.xml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,10 @@
654654
<t>
655655
Evaluation of a parent schema object can complete once all of its
656656
subschemas have been evaluated, although in some circumstances evaluation
657-
may be short-circuited due to assertion results.
657+
may be short-circuited due to assertion results. When annotations are
658+
being collected, some assertion result short-circuiting is not possible
659+
due to the need to collect annotations from all subschemas, including
660+
those that cannot further change the assertion result.
658661
</t>
659662
<section title="Keyword Interactions">
660663
<t>
@@ -1981,6 +1984,8 @@
19811984
<t>
19821985
An instance validates successfully against this keyword if it validates
19831986
successfully against at least one schema defined by this keyword's value.
1987+
Note that when annotations are being collected, they MUST be collected
1988+
from all subschemas if any subschema validates successfully.
19841989
</t>
19851990
</section>
19861991

@@ -2245,16 +2250,10 @@
22452250
</t>
22462251
<t>
22472252
An array instance is valid against "contains" if at least one of
2248-
its elements is valid against the given schema. This keyword
2249-
does not produce annotation results.
2250-
<cref>
2251-
Should it produce a set of the indices for which the
2252-
array element is valid against the subschema? "contains"
2253-
does not affect "additionalItems" or any other current
2254-
or proposed keyword, but the information could be useful,
2255-
and implementation that collect annotations need to
2256-
apply "contains" to every element anyway.
2257-
</cref>
2253+
its elements is valid against the given schema. Note that when
2254+
collecting annotations, the subschema MUST be applied to every
2255+
array element even after the first match has been found. This
2256+
is to ensure that all possible annotations are collected.
22582257
</t>
22592258
</section>
22602259
</section>

jsonschema-validation.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,9 +1220,9 @@
12201220
their results, without asserting any conditions of their own.
12211221
Without assertion keywords, these applicators can only cause assertion
12221222
failures by using the false boolean schema, or by inverting the result
1223-
of the true boolean schema. For this reason, they are better defined
1224-
as a generic mechanism on which validation, hyper-schema, and extension
1225-
vocabularies can all be based
1223+
of the true boolean schema (or equivalent schema objects).
1224+
For this reason, they are better defined as a generic mechanism on which
1225+
validation, hyper-schema, and extension vocabularies can all be based.
12261226
</t>
12271227
<t hangText='"dependencies"'>
12281228
This keyword had two different modes of behavior, which made it

0 commit comments

Comments
 (0)