812
812
location, annotation keywords need to specify any unusual handling of
813
813
multiple applicable occurrences of the keyword with different values.
814
814
</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 >
821
815
<t >
822
816
Unlike assertion results, annotation data can take a wide variety of forms,
823
817
which are provided to applications to use as they see fit. JSON Schema
824
818
implementations are not expected to make use of the collected information
825
819
on behalf of applications.
826
820
</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 >
827
828
<t >
828
829
While "short-circuit" evaluation is possible for assertions, collecting
829
830
annotations requires examining all schemas that apply to an instance
830
831
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.
831
835
</t >
832
836
833
837
<section title =" Collecting Annotations" >
863
867
If the same keyword attaches values from multiple schema locations
864
868
to the same instance location, and the annotation defines a process
865
869
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.
867
873
</t >
868
874
<section title =" Distinguishing Among Multiple Values" >
869
875
<t >
2649
2655
<figure >
2650
2656
<artwork >
2651
2657
<![CDATA[
2652
- #/properties/minLength /$ref/minimum
2658
+ #/properties/width /$ref/minimum
2653
2659
]]>
2654
2660
</artwork >
2655
2661
</figure >
2656
2662
<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.
2659
2665
</t >
2660
2666
<t >
2661
2667
The JSON key for this information is "keywordLocation".
2665
2671
<section title =" Keyword Absolute Location" >
2666
2672
<t >
2667
2673
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.
2670
2679
</t >
2671
2680
<figure >
2672
2681
<artwork >
2673
2682
<![CDATA[
2674
- https://json-schema.org/draft/2019-08/schema #/$defs/nonNegativeInteger /minimum
2683
+ https://example.com/schemas/common #/$defs/count /minimum
2675
2684
]]>
2676
2685
</artwork >
2677
2686
</figure >
@@ -2687,7 +2696,7 @@ https://json-schema.org/draft/2019-08/schema#/$defs/nonNegativeInteger/minimum
2687
2696
<section title =" Instance Location" >
2688
2697
<t >
2689
2698
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.
2691
2700
</t >
2692
2701
<t >
2693
2702
The JSON key for this information is "instanceLocation".
@@ -2702,6 +2711,10 @@ https://json-schema.org/draft/2019-08/schema#/$defs/nonNegativeInteger/minimum
2702
2711
For errors, the specific wording for the message is not defined by this
2703
2712
specification. Implementations will need to provide this.
2704
2713
</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 >
2705
2718
<t >
2706
2719
The JSON key for failed validations is "error"; for successful validations
2707
2720
it is "annotation".
@@ -2715,7 +2728,8 @@ https://json-schema.org/draft/2019-08/schema#/$defs/nonNegativeInteger/minimum
2715
2728
</t >
2716
2729
<t >
2717
2730
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.
2719
2733
</t >
2720
2734
</section >
2721
2735
0 commit comments