From 148cb4fea2c5c3f7bfe01be238ecd107e39a1e63 Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Wed, 10 Aug 2022 14:28:28 -0700 Subject: [PATCH 1/2] 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. --- jsonschema-core.xml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 5343194f..b3ea04e0 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -350,9 +350,9 @@ and its companions, are free to define other behaviors as well. - 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, or are not recognized as, schema keywords. + The behavior of such keywords is governed by section + . An empty schema is a JSON Schema with no properties, or only unknown @@ -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. 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. + +
+ + 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. + +
From 284a09abc387f85a1f451d9d270682bd75014c84 Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Thu, 11 Aug 2022 21:11:25 -0700 Subject: [PATCH 2/2] Better phrasing / grammar from review feedback. Co-authored-by: Jason Desrosiers --- jsonschema-core.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index b3ea04e0..8fde61dc 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -350,7 +350,7 @@ and its companions, are free to define other behaviors as well. - A JSON Schema MAY contain properties which are not, or are not recognized as, schema keywords. + A JSON Schema MAY contain properties which are not schema keywords or are not recognized as schema keywords. The behavior of such keywords is governed by section .