Skip to content

Ignore unknown keywords or treat as annotations #1269

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 5, 2022
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
17 changes: 12 additions & 5 deletions jsonschema-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@
and its companions, are free to define other behaviors as well.
</t>
<t>
A JSON Schema MAY contain properties which are not schema keywords.
Unknown keywords SHOULD be treated as annotations, where the value
of the keyword is the value of the annotation.
A JSON Schema MAY contain properties which are not schema keywords or are not recognized as schema keywords.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd suffice to say "A JSON Schema MAY contain properties which are not recognized as schema keywords."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I see this was the subject of the resolved review. no need to relitigate that if it's been sufficiently addressed, disregard if so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@notEthan I preserved the "not schema keywords" part from the original text because I don't remember why it was phrased that way and did not want to get into a debate about whether it is OK to remove it. If you think it should be removed, we should probably discuss that in an issue. I figured adding "or are not recognized as..." would cover the more common way this is thought about without removing anything previously allowed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me

The behavior of such keywords is governed by section
<xref target="unrecognized" format="counter"></xref>.
</t>
<t>
An empty schema is a JSON Schema with no properties, or only unknown
Expand Down Expand Up @@ -600,14 +600,21 @@
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 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
for vocabularies that they do not support directly. The exact mechanism
for registering and implementing such handlers is implementation-dependent.
</t>

<section title="Handling of unrecognized or unsupported keywords" anchor="unrecognized">
<t>
Implementations SHOULD treat keywords they do not recognize, or that
they recognize but do not support, as annotations, where the value of
the keyword is the value of the annotation. Whether an implementation
collects these annotations or not, they MUST otherwise ignore the keywords.
</t>
</section>
</section>

</section>
Expand Down