Skip to content

Commit 77d7f9e

Browse files
committed
Improve guidance on annotations and output
Remove wording that is no longer meaningful now that we have recommended output formats. Also do not use meta-schema as example for relative and absolute paths because my brain broke trying to figure out what it was doing.
1 parent 553489d commit 77d7f9e

File tree

2 files changed

+38
-23
lines changed

2 files changed

+38
-23
lines changed

jsonschema-core.xml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -812,22 +812,26 @@
812812
location, annotation keywords need to specify any unusual handling of
813813
multiple applicable occurrences of the keyword with different values.
814814
</t>
815-
<t>
816-
The default behavior is simply to collect all values in a list in
817-
indeterminate order. Given the extensibility of keywords, including
818-
applicators, it is not possible to define a universally predictable
819-
order of processing.
820-
</t>
821815
<t>
822816
Unlike assertion results, annotation data can take a wide variety of forms,
823817
which are provided to applications to use as they see fit. JSON Schema
824818
implementations are not expected to make use of the collected information
825819
on behalf of applications.
826820
</t>
821+
<t>
822+
Unless otherwise specified, the value of an annotation keyword's
823+
annotation is the keyword's value. However, other behaviors are possible.
824+
For example, <xref target="json-hyper-schema">JSON Hyper-Schema's</xref>
825+
"links" keyword is a complex annotation that produces a value based
826+
in part on the instance data.
827+
</t>
827828
<t>
828829
While "short-circuit" evaluation is possible for assertions, collecting
829830
annotations requires examining all schemas that apply to an instance
830831
location, even if they cannot change the overall assertion result.
832+
The only exception is that subschemas of a schema object that has
833+
failed validation MAY be skipped, as annotations are not retained
834+
for failing schemas.
831835
</t>
832836

833837
<section title="Collecting Annotations">
@@ -863,7 +867,9 @@
863867
If the same keyword attaches values from multiple schema locations
864868
to the same instance location, and the annotation defines a process
865869
for combining such values, then the combined value MUST also be associated
866-
with the instance location.
870+
with the instance location. The <xref target="output">output formats</xref>
871+
described in this specification that include annotation information
872+
meet this requirement.
867873
</t>
868874
<section title="Distinguishing Among Multiple Values">
869875
<t>
@@ -2649,13 +2655,13 @@
26492655
<figure>
26502656
<artwork>
26512657
<![CDATA[
2652-
#/properties/minLength/$ref/minimum
2658+
#/properties/width/$ref/minimum
26532659
]]>
26542660
</artwork>
26552661
</figure>
26562662
<t>
2657-
Note that this pointer may not be resolvable due to the inclusion of these
2658-
applicator keywords.
2663+
Note that this pointer may not be resolvable by the normal JSON Pointer process
2664+
due to the inclusion of these by-reference applicator keywords.
26592665
</t>
26602666
<t>
26612667
The JSON key for this information is "keywordLocation".
@@ -2665,13 +2671,16 @@
26652671
<section title="Keyword Absolute Location">
26662672
<t>
26672673
The absolute, dereferenced location of the validating keyword. The value MUST
2668-
be expressed as an absolute URI, and it MUST NOT include by-reference applicators
2669-
such as "$ref" or "$recursiveRef".
2674+
be expressed as an absolute URI using the canonical URI of the relevant
2675+
schema object, and it MUST NOT include by-reference applicators
2676+
such as "$ref" or "$recursiveRef" as non-terminal path components.
2677+
It MAY end in such keywords if the error or annotation is for that
2678+
keyword, such as an unresolvable reference.
26702679
</t>
26712680
<figure>
26722681
<artwork>
26732682
<![CDATA[
2674-
https://json-schema.org/draft/2019-08/schema#/$defs/nonNegativeInteger/minimum
2683+
https://example.com/schemas/common#/$defs/count/minimum
26752684
]]>
26762685
</artwork>
26772686
</figure>
@@ -2687,7 +2696,7 @@ https://json-schema.org/draft/2019-08/schema#/$defs/nonNegativeInteger/minimum
26872696
<section title="Instance Location">
26882697
<t>
26892698
The location of the JSON value within the instance being validated. The
2690-
value MUST be expressed as a JSON Pointer.
2699+
value MUST be expressed as a URI fragment-encoded JSON Pointer.
26912700
</t>
26922701
<t>
26932702
The JSON key for this information is "instanceLocation".
@@ -2702,6 +2711,10 @@ https://json-schema.org/draft/2019-08/schema#/$defs/nonNegativeInteger/minimum
27022711
For errors, the specific wording for the message is not defined by this
27032712
specification. Implementations will need to provide this.
27042713
</t>
2714+
<t>
2715+
For annotations, each keyword that produces an annotation specifies its
2716+
format. By default, it is the keyword's value.
2717+
</t>
27052718
<t>
27062719
The JSON key for failed validations is "error"; for successful validations
27072720
it is "annotation".
@@ -2715,7 +2728,8 @@ https://json-schema.org/draft/2019-08/schema#/$defs/nonNegativeInteger/minimum
27152728
</t>
27162729
<t>
27172730
The JSON key for nested results in failed validations is "errors"; for
2718-
successful validations it is "annotations".
2731+
successful validations it is "annotations". Note the plural forms, as
2732+
a keyword with nested results can also have a local error or annotation.
27192733
</t>
27202734
</section>
27212735

jsonschema-validation.xml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@
137137
<t>
138138
This specification defines a set of assertion keywords, as well as a small vocabulary
139139
of metadata keywords that can be used to annotate the JSON instance with
140-
useful information. The <xref target="format" /> and <xref target="content" />
141-
keywords are also useful as annotations as well as being optional assertions,
142-
as they convey additional usage guidance for the instance data.
140+
useful information. The <xref target="format" /> keyword is intended primarily
141+
as an annotation, but can optionally be used as an assertion. The
142+
<xref target="content" /> keywords are annotations for working with documents
143+
embedded as JSON strings.
143144
</t>
144145
</section>
145146

@@ -1157,9 +1158,9 @@
11571158
<section title='"deprecated"'>
11581159
<t>
11591160
The value of this keyword MUST be a boolean. When multiple occurrences
1160-
of this keyword are applicable to a single sub-instance, the resulting
1161-
value MUST be true if any occurrence specifies a true value, and MUST
1162-
be false otherwise.
1161+
of this keyword are applicable to a single sub-instance, applications
1162+
SHOULD consider the instance location to be deprecated if any occurrence
1163+
specifies a true value.
11631164
</t>
11641165
<t>
11651166
If "deprecated" has a value of boolean true, it indicates that applications
@@ -1179,8 +1180,8 @@
11791180
<t>
11801181
The value of these keywords MUST be a boolean. When multiple occurrences
11811182
of these keywords are applicable to a single sub-instance, the resulting
1182-
value MUST be true if any occurrence specifies a true value, and MUST
1183-
be false otherwise.
1183+
behavior SHOULD be as for a true value if any occurrence specifies a true value,
1184+
and SHOULD be as for a false value otherwise.
11841185
</t>
11851186
<t>
11861187
If "readOnly" has a value of boolean true, it indicates that the value

0 commit comments

Comments
 (0)