From cb7861b3b90e8d176f29ef7e490efc30222c1bcd Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Wed, 19 Oct 2022 12:43:46 +1300 Subject: [PATCH 1/4] add droppedAnnotations --- jsonschema-core.xml | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 5a078dc4..adc255f0 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2888,11 +2888,14 @@ https://example.com/schemas/common#/$defs/allOf/1
- Any annotations produced by the validation. This property MUST NOT - be included if the validation was unsuccessful. The value - for this property MUST be an object where the keys are the names of - keywords and the values are the annotations produced by the - associated keyword. + Any annotations produced by the evaluation. This property MUST NOT + be included if the validation result of the containing subschema was + unsuccessful. + + + The value for this property MUST be an object where the + keys are the names of keywords and the values are the annotations + produced by the associated keyword. Each keyword defines its own annotation data type (e.g. "properties" @@ -2903,6 +2906,32 @@ https://example.com/schemas/common#/$defs/allOf/1
+
+ + Any annotations produced and subsequently dropped by the evaluation + due to an unsuccessful validation result of the containing subschema. + This property MAY be included if the validation result of the containing + subschema was unsuccessful. It MUST NOT be included if the local + validation result of the containing subschema was successful. + + + Implementations that wish to include these annotations are encouraged + to provide users with a configuration option to exclude them. + + + The value for this property MUST be an object where the + keys are the names of keywords and the values are the annotations + produced by the associated keyword. + + + Each keyword defines its own annotation data type (e.g. "properties" + produces a list of keywords, whereas "title" produces a string). + + + The JSON key for this information is "droppedAnnotations". + +
+
Nested results are generated from keywords which create a new dynamic From 8ea42da75683516e1bd3f12da935bff5814aaf5d Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Thu, 20 Oct 2022 10:55:52 +1300 Subject: [PATCH 2/4] add droppedAnnotations to sample output --- jsonschema-core.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index adc255f0..091aa866 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -3325,6 +3325,10 @@ https://example.com/schemas/common#/$defs/allOf/1 "evaluationPath": "/properties/foo/allOf/1", "schemaLocation": "https://json-schema.org/schemas/example#/properties/foo/allOf/1", "instanceLocation": "/foo", + "droppedAnnotations": { + "properties": [ "foo-prop" ], + "title": "foo-title" + }, "nested": [ { "valid": false, @@ -3333,6 +3337,9 @@ https://example.com/schemas/common#/$defs/allOf/1 "instanceLocation": "/foo/foo-prop", "errors": { "const": "Expected \"1\"" + }, + "droppedAnnotations": { + "title": "foo-prop-title" } }, { @@ -3356,6 +3363,10 @@ https://example.com/schemas/common#/$defs/allOf/1 "evaluationPath": "/properties/bar/$ref", "schemaLocation": "https://json-schema.org/schemas/example#/$defs/bar", "instanceLocation": "/bar", + "droppedAnnotations": { + "properties": [ "bar-prop" ], + "title": "bar-title" + }, "nested": [ { "valid": false, @@ -3364,6 +3375,9 @@ https://example.com/schemas/common#/$defs/allOf/1 "instanceLocation": "/bar/bar-prop", "errors": { "minimum": "2 is less than or equal to 10" + }, + "droppedAnnotations": { + "title": "bar-prop-title" } } ] From c8f45323d318d4d45d0a7c1da7c82a6e75f6fe38 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Thu, 27 Oct 2022 10:03:56 +1300 Subject: [PATCH 3/4] add droppedAnnotations to output validation schema --- output/schema.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/output/schema.json b/output/schema.json index b3b80799..be2ec3fd 100644 --- a/output/schema.json +++ b/output/schema.json @@ -31,6 +31,10 @@ "type": "object", "additionalProperties": true }, + "droppedAnnotations": { + "type": "object", + "additionalProperties": true + }, "errors": { "type": "object", "additionalProperties": { "type": "string" } @@ -40,7 +44,14 @@ "allOf": [ { "if": { - "required": [ "errors" ] + "anyOf": [ + { + "required": [ "errors" ] + }, + { + "required": [ "droppedAnnotations" ] + } + ] }, "then": { "properties": { From c28c256df8a317e3a2823d81fc960e86b04b5106 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Thu, 27 Oct 2022 10:22:55 +1300 Subject: [PATCH 4/4] reworked droppedAnnotations language to require opt-in --- jsonschema-core.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jsonschema-core.xml b/jsonschema-core.xml index 091aa866..354cf8a0 100644 --- a/jsonschema-core.xml +++ b/jsonschema-core.xml @@ -2915,8 +2915,9 @@ https://example.com/schemas/common#/$defs/allOf/1 validation result of the containing subschema was successful. - Implementations that wish to include these annotations are encouraged - to provide users with a configuration option to exclude them. + Implementations that wish to provide these annotations MUST NOT provide + them as their default behavior. These annotations MUST only be included + by explicitly configuring the implementation to do so. The value for this property MUST be an object where the