Skip to content

Commit 148cb4f

Browse files
committed
Ignore unknown keywords or treat as annotations
When we added the "SHOULD collect as annotations" behavior for unknown keywords, we forgot to retain the MUST directive to ignore them if the SHOULD is not followed. Which also ensures that no other behavior than collecting as a annotations is performed. This also consolidates the behavioral specification in one place as it appeared in two places before.
1 parent d775a9d commit 148cb4f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Diff for: jsonschema-core.xml

+12-5
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,9 @@
350350
and its companions, are free to define other behaviors as well.
351351
</t>
352352
<t>
353-
A JSON Schema MAY contain properties which are not schema keywords.
354-
Unknown keywords SHOULD be treated as annotations, where the value
355-
of the keyword is the value of the annotation.
353+
A JSON Schema MAY contain properties which are not, or are not recognized as, schema keywords.
354+
The behavior of such keywords is governed by section
355+
<xref target="unrecognized" format="counter"></xref>.
356356
</t>
357357
<t>
358358
An empty schema is a JSON Schema with no properties, or only unknown
@@ -600,14 +600,21 @@
600600
by any entity. Save for explicit agreement, schema authors SHALL NOT
601601
expect these additional keywords and vocabularies to be supported by
602602
implementations that do not explicitly document such support.
603-
Implementations SHOULD treat keywords they do not support as annotations,
604-
where the value of the keyword is the value of the annotation.
605603
</t>
606604
<t>
607605
Implementations MAY provide the ability to register or load handlers
608606
for vocabularies that they do not support directly. The exact mechanism
609607
for registering and implementing such handlers is implementation-dependent.
610608
</t>
609+
610+
<section title="Handling of unrecognized or unsupported keywords" anchor="unrecognized">
611+
<t>
612+
Implementations SHOULD treat keywords they do not recognize, or that
613+
they recognize but do not support, as annotations, where the value of
614+
the keyword is the value of the annotation. Whether an implementation
615+
collects these annotations or not, they MUST otherwise ignore the keywords.
616+
</t>
617+
</section>
611618
</section>
612619

613620
</section>

0 commit comments

Comments
 (0)