Skip to content

Commit 0ab50fe

Browse files
authored
Merge pull request #1247 from json-schema-org/changing-property-key-names-in-output-format
Changing property key names in output format
2 parents 86d5739 + 4d1f63f commit 0ab50fe

File tree

2 files changed

+84
-81
lines changed

2 files changed

+84
-81
lines changed

jsonschema-core.xml

+46-43
Original file line numberDiff line numberDiff line change
@@ -2704,9 +2704,15 @@
27042704

27052705
<section title="Keyword Relative Location">
27062706
<t>
2707-
The relative location of the validating keyword that follows the validation
2708-
path. The value MUST be expressed as a JSON Pointer, and it MUST include
2709-
any by-reference applicators such as "$ref" or "$dynamicRef".
2707+
The relative location of the validating keyword that follows the path
2708+
traversed through the schema. The value MUST be expressed as a JSON
2709+
Pointer, and it MUST include any by-reference applicators such as
2710+
"$ref" or "$dynamicRef".
2711+
<cref>
2712+
The schema may not actually have a value at the location indicated
2713+
by this pointer. It is provided as an indication of the traversal
2714+
path only.
2715+
</cref>
27102716
</t>
27112717
<figure>
27122718
<artwork>
@@ -2720,7 +2726,7 @@
27202726
due to the inclusion of these by-reference applicator keywords.
27212727
</t>
27222728
<t>
2723-
The JSON key for this information is "keywordLocation".
2729+
The JSON key for this information is "evaluationPath".
27242730
</t>
27252731
</section>
27262732

@@ -2752,7 +2758,7 @@ https://example.com/schemas/common#/$defs/count/minimum
27522758
over a reference or if the schema does not declare an absolute IRI as its "$id".
27532759
</t>
27542760
<t>
2755-
The JSON key for this information is "absoluteKeywordLocation".
2761+
The JSON key for this information is "schemaLocation".
27562762
</t>
27572763
</section>
27582764

@@ -2786,13 +2792,15 @@ https://example.com/schemas/common#/$defs/count/minimum
27862792

27872793
<section title="Nested Results">
27882794
<t>
2789-
For the two hierarchical structures, this property will hold nested errors
2790-
and annotations.
2795+
For "basic", this property will appear only at the root node and will hold
2796+
all errors or annotations in a list.
2797+
</t>
2798+
<t>
2799+
For "detailed" and "verbose", this property will hold nested errors
2800+
and annotations in a tree structure, mimicking that of the schema.
27912801
</t>
27922802
<t>
2793-
The JSON key for nested results in failed validations is "errors"; for
2794-
successful validations it is "annotations". Note the plural forms, as
2795-
a keyword with nested results can also have a local error or annotation.
2803+
The JSON key for nested results is "nested".
27962804
</t>
27972805
</section>
27982806

@@ -2802,19 +2810,14 @@ https://example.com/schemas/common#/$defs/count/minimum
28022810
<t>
28032811
The output MUST be an object containing a boolean property named "valid". When
28042812
additional information about the result is required, the output MUST also contain
2805-
"errors" or "annotations" as described below.
2813+
"nested" as described below.
28062814
<list>
28072815
<t>
28082816
"valid" - a boolean value indicating the overall validation success or
28092817
failure
28102818
</t>
28112819
<t>
2812-
"errors" - the collection of errors or annotations produced by a failed
2813-
validation
2814-
</t>
2815-
<t>
2816-
"annotations" - the collection of errors or annotations produced by a
2817-
successful validation
2820+
"nested" - the collection of errors or annotations produced by a keyword
28182821
</t>
28192822
</list>
28202823
For these examples, the following schema and instance will be used.
@@ -2910,35 +2913,35 @@ https://example.com/schemas/common#/$defs/count/minimum
29102913
<![CDATA[
29112914
{
29122915
"valid": false,
2913-
"errors": [
2916+
"nested": [
29142917
{
2915-
"keywordLocation": "",
2918+
"evaluationPath": "",
29162919
"instanceLocation": "",
29172920
"error": "A subschema had errors."
29182921
},
29192922
{
2920-
"keywordLocation": "/items/$ref",
2921-
"absoluteKeywordLocation":
2923+
"evaluationPath": "/items/$ref",
2924+
"schemaLocation":
29222925
"https://example.com/polygon#/$defs/point",
29232926
"instanceLocation": "/1",
29242927
"error": "A subschema had errors."
29252928
},
29262929
{
2927-
"keywordLocation": "/items/$ref/required",
2928-
"absoluteKeywordLocation":
2930+
"evaluationPath": "/items/$ref/required",
2931+
"schemaLocation":
29292932
"https://example.com/polygon#/$defs/point/required",
29302933
"instanceLocation": "/1",
29312934
"error": "Required property 'y' not found."
29322935
},
29332936
{
2934-
"keywordLocation": "/items/$ref/additionalProperties",
2935-
"absoluteKeywordLocation":
2937+
"evaluationPath": "/items/$ref/additionalProperties",
2938+
"schemaLocation":
29362939
"https://example.com/polygon#/$defs/point/additionalProperties",
29372940
"instanceLocation": "/1/z",
29382941
"error": "Additional property 'z' found but was invalid."
29392942
},
29402943
{
2941-
"keywordLocation": "/minItems",
2944+
"evaluationPath": "/minItems",
29422945
"instanceLocation": "",
29432946
"error": "Expected at least 3 items but found 2"
29442947
}
@@ -2979,28 +2982,28 @@ https://example.com/schemas/common#/$defs/count/minimum
29792982
<![CDATA[
29802983
{
29812984
"valid": false,
2982-
"keywordLocation": "",
2985+
"evaluationPath": "",
29832986
"instanceLocation": "",
2984-
"errors": [
2987+
"nested": [
29852988
{
29862989
"valid": false,
2987-
"keywordLocation": "/items/$ref",
2988-
"absoluteKeywordLocation":
2990+
"evaluationPath": "/items/$ref",
2991+
"schemaLocation":
29892992
"https://example.com/polygon#/$defs/point",
29902993
"instanceLocation": "/1",
2991-
"errors": [
2994+
"nested": [
29922995
{
29932996
"valid": false,
2994-
"keywordLocation": "/items/$ref/required",
2995-
"absoluteKeywordLocation":
2997+
"evaluationPath": "/items/$ref/required",
2998+
"schemaLocation":
29962999
"https://example.com/polygon#/$defs/point/required",
29973000
"instanceLocation": "/1",
29983001
"error": "Required property 'y' not found."
29993002
},
30003003
{
30013004
"valid": false,
3002-
"keywordLocation": "/items/$ref/additionalProperties",
3003-
"absoluteKeywordLocation":
3005+
"evaluationPath": "/items/$ref/additionalProperties",
3006+
"schemaLocation":
30043007
"https://example.com/polygon#/$defs/point/additionalProperties",
30053008
"instanceLocation": "/1/z",
30063009
"error": "Additional property 'z' found but was invalid."
@@ -3009,7 +3012,7 @@ https://example.com/schemas/common#/$defs/count/minimum
30093012
},
30103013
{
30113014
"valid": false,
3012-
"keywordLocation": "/minItems",
3015+
"evaluationPath": "/minItems",
30133016
"instanceLocation": "",
30143017
"error": "Expected at least 3 items but found 2"
30153018
}
@@ -3062,27 +3065,27 @@ https://example.com/schemas/common#/$defs/count/minimum
30623065
// result
30633066
{
30643067
"valid": false,
3065-
"keywordLocation": "",
3068+
"evaluationPath": "",
30663069
"instanceLocation": "",
3067-
"errors": [
3070+
"nested": [
30683071
{
30693072
"valid": true,
3070-
"keywordLocation": "/type",
3073+
"evaluationPath": "/type",
30713074
"instanceLocation": ""
30723075
},
30733076
{
30743077
"valid": true,
3075-
"keywordLocation": "/properties",
3078+
"evaluationPath": "/properties",
30763079
"instanceLocation": ""
30773080
},
30783081
{
30793082
"valid": false,
3080-
"keywordLocation": "/additionalProperties",
3083+
"evaluationPath": "/additionalProperties",
30813084
"instanceLocation": "",
3082-
"errors": [
3085+
"nested": [
30833086
{
30843087
"valid": false,
3085-
"keywordLocation": "/additionalProperties",
3088+
"evaluationPath": "/additionalProperties",
30863089
"instanceLocation": "/disallowedProp",
30873090
"error": "Additional property 'disallowedProp' found but was invalid."
30883091
}

output/verbose-example.json

+38-38
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
11
{
22
"valid": false,
3-
"keywordLocation": "",
3+
"evaluationPath": "",
44
"instanceLocation": "",
5-
"errors": [
5+
"nested": [
66
{
77
"valid": true,
8-
"keywordLocation": "/$defs",
8+
"evaluationPath": "/$defs",
99
"instanceLocation": ""
1010
},
1111
{
1212
"valid": true,
13-
"keywordLocation": "/type",
13+
"evaluationPath": "/type",
1414
"instanceLocation": ""
1515
},
1616
{
1717
"valid": false,
18-
"keywordLocation": "/items",
18+
"evaluationPath": "/items",
1919
"instanceLocation": "",
20-
"errors": [
20+
"nested": [
2121
{
2222
"valid": true,
23-
"keywordLocation": "/items/$ref",
24-
"absoluteKeywordLocation":
23+
"evaluationPath": "/items/$ref",
24+
"schemaLocation":
2525
"https://example.com/polygon#/items/$ref",
2626
"instanceLocation": "/0",
27-
"annotations": [
27+
"nested": [
2828
{
2929
"valid": true,
30-
"keywordLocation": "/items/$ref",
31-
"absoluteKeywordLocation":
30+
"evaluationPath": "/items/$ref",
31+
"schemaLocation":
3232
"https://example.com/polygon#/$defs/point",
3333
"instanceLocation": "/0",
34-
"annotations": [
34+
"nested": [
3535
{
3636
"valid": true,
37-
"keywordLocation": "/items/$ref/type",
38-
"absoluteKeywordLocation":
37+
"evaluationPath": "/items/$ref/type",
38+
"schemaLocation":
3939
"https://example.com/polygon#/$defs/point/type",
4040
"instanceLocation": "/0"
4141
},
4242
{
4343
"valid": true,
44-
"keywordLocation": "/items/$ref/properties",
45-
"absoluteKeywordLocation":
44+
"evaluationPath": "/items/$ref/properties",
45+
"schemaLocation":
4646
"https://example.com/polygon#/$defs/point/properties",
4747
"instanceLocation": "/0"
4848
},
4949
{
5050
"valid": true,
51-
"keywordLocation": "/items/$ref/required",
52-
"absoluteKeywordLocation":
51+
"evaluationPath": "/items/$ref/required",
52+
"schemaLocation":
5353
"https://example.com/polygon#/$defs/point/required",
5454
"instanceLocation": "/0"
5555
},
5656
{
5757
"valid": true,
58-
"keywordLocation": "/items/$ref/additionalProperties",
59-
"absoluteKeywordLocation":
58+
"evaluationPath": "/items/$ref/additionalProperties",
59+
"schemaLocation":
6060
"https://example.com/polygon#/$defs/point/additionalProperties",
6161
"instanceLocation": "/0"
6262
}
@@ -66,50 +66,50 @@
6666
},
6767
{
6868
"valid": false,
69-
"keywordLocation": "/items/$ref",
70-
"absoluteKeywordLocation":
69+
"evaluationPath": "/items/$ref",
70+
"schemaLocation":
7171
"https://example.com/polygon#/items/$ref",
7272
"instanceLocation": "/1",
73-
"errors": [
73+
"nested": [
7474
{
7575
"valid": false,
76-
"keywordLocation": "/items/$ref",
77-
"absoluteKeywordLocation":
76+
"evaluationPath": "/items/$ref",
77+
"schemaLocation":
7878
"https://example.com/polygon#/$defs/point",
7979
"instanceLocation": "/1",
80-
"errors": [
80+
"nested": [
8181
{
8282
"valid": true,
83-
"keywordLocation": "/items/$ref/type",
84-
"absoluteKeywordLocation":
83+
"evaluationPath": "/items/$ref/type",
84+
"schemaLocation":
8585
"https://example.com/polygon#/$defs/point/type",
8686
"instanceLocation": "/1"
8787
},
8888
{
8989
"valid": true,
90-
"keywordLocation": "/items/$ref/properties",
91-
"absoluteKeywordLocation":
90+
"evaluationPath": "/items/$ref/properties",
91+
"schemaLocation":
9292
"https://example.com/polygon#/$defs/point/properties",
9393
"instanceLocation": "/1"
9494
},
9595
{
9696
"valid": false,
97-
"keywordLocation": "/items/$ref/required",
98-
"absoluteKeywordLocation":
97+
"evaluationPath": "/items/$ref/required",
98+
"schemaLocation":
9999
"https://example.com/polygon#/$defs/point/required",
100100
"instanceLocation": "/1"
101101
},
102102
{
103103
"valid": false,
104-
"keywordLocation": "/items/$ref/additionalProperties",
105-
"absoluteKeywordLocation":
104+
"evaluationPath": "/items/$ref/additionalProperties",
105+
"schemaLocation":
106106
"https://example.com/polygon#/$defs/point/additionalProperties",
107107
"instanceLocation": "/1",
108-
"errors": [
108+
"nested": [
109109
{
110110
"valid": false,
111-
"keywordLocation": "/items/$ref/additionalProperties",
112-
"absoluteKeywordLocation":
111+
"evaluationPath": "/items/$ref/additionalProperties",
112+
"schemaLocation":
113113
"https://example.com/polygon#/$defs/point/additionalProperties",
114114
"instanceLocation": "/1/z"
115115
}
@@ -123,7 +123,7 @@
123123
},
124124
{
125125
"valid": false,
126-
"keywordLocation": "/minItems",
126+
"evaluationPath": "/minItems",
127127
"instanceLocation": ""
128128
}
129129
]

0 commit comments

Comments
 (0)