Skip to content

add droppedAnnotations #1329

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 4 commits into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
53 changes: 48 additions & 5 deletions jsonschema-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2888,11 +2888,14 @@ https://example.com/schemas/common#/$defs/allOf/1

<section title="Annotations">
<t>
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.
</t>
<t>
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.
</t>
<t>
Each keyword defines its own annotation data type (e.g. "properties"
Expand All @@ -2903,6 +2906,32 @@ https://example.com/schemas/common#/$defs/allOf/1
</t>
</section>

<section title="Dropped Annotations">
<t>
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.
</t>
<t>
Implementations that wish to include these annotations are encouraged
to provide users with a configuration option to exclude them.
</t>
<t>
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.
</t>
<t>
Each keyword defines its own annotation data type (e.g. "properties"
produces a list of keywords, whereas "title" produces a string).
</t>
<t>
The JSON key for this information is "droppedAnnotations".
</t>
</section>

<section title="Nested Results">
<t>
Nested results are generated from keywords which create a new dynamic
Expand Down Expand Up @@ -3296,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,
Expand All @@ -3304,6 +3337,9 @@ https://example.com/schemas/common#/$defs/allOf/1
"instanceLocation": "/foo/foo-prop",
"errors": {
"const": "Expected \"1\""
},
"droppedAnnotations": {
"title": "foo-prop-title"
}
},
{
Expand All @@ -3327,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,
Expand All @@ -3335,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"
}
}
]
Expand Down
13 changes: 12 additions & 1 deletion output/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"type": "object",
"additionalProperties": true
},
"droppedAnnotations": {
"type": "object",
"additionalProperties": true
},
"errors": {
"type": "object",
"additionalProperties": { "type": "string" }
Expand All @@ -40,7 +44,14 @@
"allOf": [
{
"if": {
"required": [ "errors" ]
"anyOf": [
{
"required": [ "errors" ]
},
{
"required": [ "droppedAnnotations" ]
}
]
},
"then": {
"properties": {
Expand Down