Skip to content

Collect unknown keywords as annotations #987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions jsonschema-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@
<t>
JSON Schema can be extended either by defining additional vocabularies,
or less formally by defining additional keywords outside of any vocabulary.
Unrecognized individual keywords are ignored, while the behavior with respect
to an unrecognized vocabulary can be controlled when declaring which
vocabularies are in use.
Unrecognized individual keywords simply have their values collected as annotations,
while the behavior with respect to an unrecognized vocabulary can be controlled
when declaring which vocabularies are in use.
</t>
<t>
This document defines a core vocabulary that MUST be supported by any
Expand Down Expand Up @@ -351,7 +351,8 @@
</t>
<t>
A JSON Schema MAY contain properties which are not schema keywords.
Unknown keywords SHOULD be ignored.
Unknown keywords SHOULD be treated as annotations, where the value
of the keyword is the value of the annotation.
</t>
<t>
An empty schema is a JSON Schema with no properties, or only unknown
Expand Down Expand Up @@ -575,7 +576,8 @@
by any entity. Save for explicit agreement, schema authors SHALL NOT
expect these additional keywords and vocabularies to be supported by
implementations that do not explicitly document such support.
Implementations SHOULD ignore keywords they do not support.
Implementations SHOULD treat keywords they do not support as annotations,
where the value of the keyword is the value of the annotation.
</t>
<t>
Implementations MAY provide the ability to register or load handlers
Expand Down Expand Up @@ -1237,7 +1239,8 @@
</t>
<t>
Per <xref target="extending" format="counter"></xref>, unrecognized
keywords SHOULD be ignored. This remains the case for keywords defined
keywords SHOULD be treated as annotations.
This remains the case for keywords defined
by unrecognized vocabularies. It is not currently possible to distinguish
between unrecognized keywords that are defined in vocabularies from
those that are not part of any vocabulary.
Expand Down Expand Up @@ -3090,6 +3093,11 @@ https://example.com/schemas/common#/$defs/count/minimum
system resources.
Validators MUST NOT fall into an infinite loop.
</t>
<t>
A malicious party could cause an implementation to repeatedly collect a copy
of a very large value as an annotation. Implementations SHOULD guard against
excessive consumption of system resources in such a scenario.
</t>
<t>
Servers MUST ensure that malicious parties can't change the functionality of
existing schemas by uploading a schema with a pre-existing or very similar "$id".
Expand Down