2726
2726
Basic - Provides validation information in a flat list structure.
2727
2727
</t >
2728
2728
<t >
2729
- Detailed - Provides validation information in a condensed hierarchical
2730
- structure based on the structure of the schema.
2731
- </t >
2732
- <t >
2733
- Verbose - Provides validation information in an uncondensed hierarchical
2734
- structure that matches the exact structure of the schema.
2729
+ Hierarchical - Provides validation information in a hierarchical
2730
+ structure that mimics the structure of the schema.
2731
+ <cref >
2732
+ To be precise, this structure follows the paths that a validator
2733
+ would traverse while processing the schema, including composition
2734
+ via by-reference keywords.
2735
+ </cref >
2735
2736
</t >
2736
2737
</list >
2737
- An implementation SHOULD provide at least one of the "flag", "basic", or "detailed"
2738
- format and MAY provide the "verbose" format. If it provides one or more of the
2739
- "detailed" or "verbose" formats, it MUST also provide the "flag" format.
2740
- Implementations SHOULD specify in their documentation which formats they support.
2738
+ An implementation MUST provide the "flag" format and SHOULD provide at least one
2739
+ of the "basic" or "hierarchical" formats. Implementations SHOULD specify in
2740
+ their documentation which formats they support.
2741
2741
</t >
2742
2742
2743
2743
</section >
@@ -2824,7 +2824,7 @@ https://example.com/schemas/common#/$defs/count/minimum
2824
2824
<t >
2825
2825
Any errors produced by the validation. This property MUST NOT
2826
2826
be included if the validation was successful. The value
2827
- for this property is an object where the keys are the names of
2827
+ for this property MUST be an object where the keys are the names of
2828
2828
keywords and the values are the error message produced by the
2829
2829
associated keyword. If the subschema itself is producing the
2830
2830
error, that error MUST be listed with an empty string key.
@@ -2842,7 +2842,7 @@ https://example.com/schemas/common#/$defs/count/minimum
2842
2842
<t >
2843
2843
Any annotations produced by the validation. This property MUST NOT
2844
2844
be included if the validation was unsuccessful. The value
2845
- for this property is an object where the keys are the names of
2845
+ for this property MUST be an object where the keys are the names of
2846
2846
keywords and the values are the annotations produced by the
2847
2847
associated keyword.
2848
2848
</t >
@@ -2856,13 +2856,20 @@ https://example.com/schemas/common#/$defs/count/minimum
2856
2856
</section >
2857
2857
2858
2858
<section title =" Nested Results" >
2859
+ <t >
2860
+ Nested results are generated from applicator keywords: keywords with
2861
+ subschemas or collections of subschemas as values. Keywords which
2862
+ have arrays of subschemas (e.g. "anyOf") will generally generate an output
2863
+ unit for each subschema. In order to accommodate potentially multiple
2864
+ results, the value of this property MUST be an array of output units.
2865
+ </t >
2859
2866
<t >
2860
2867
For "basic", this property will appear only at the root output unit
2861
- and will hold all results in a flat list.
2868
+ and will hold all output units in a flat list.
2862
2869
</t >
2863
2870
<t >
2864
- For "detailed" and "verbose" , this property will hold nested results
2865
- in a tree structure, mimicking that of the schema.
2871
+ For "hierarchical" , this property will hold nested results in a tree
2872
+ structure, mimicking that of the schema.
2866
2873
</t >
2867
2874
<t >
2868
2875
The sequence of output units within this list is not specified and
@@ -3016,18 +3023,18 @@ https://example.com/schemas/common#/$defs/count/minimum
3016
3023
by following the path "/properties/foo/allOf/1"
3017
3024
will produce <sourcecode >["foo-prop"]</sourcecode >.
3018
3025
</t >
3019
- <t >
3020
- The keyword "title"
3021
- validated at "/properties/foo/allOf/1/properties/foo-prop"
3022
- by following the path "/properties/foo/allOf/1/properties/foo-prop"
3023
- will produce <sourcecode >"foo-prop-title"</sourcecode >.
3024
- </t >
3025
3026
<t >
3026
3027
The keyword "additionalProperties"
3027
3028
validated at "/properties/foo/allOf/1"
3028
3029
by following the path "/properties/foo/allOf/1"
3029
3030
will produce <sourcecode >["unspecified-prop"]</sourcecode >.
3030
3031
</t >
3032
+ <t >
3033
+ The keyword "title"
3034
+ validated at "/properties/foo/allOf/1/properties/foo-prop"
3035
+ by following the path "/properties/foo/allOf/1/properties/foo-prop"
3036
+ will produce <sourcecode >"foo-prop-title"</sourcecode >.
3037
+ </t >
3031
3038
<t >
3032
3039
The keyword "title"
3033
3040
validated at "/$defs/bar"
@@ -3085,9 +3092,9 @@ https://example.com/schemas/common#/$defs/count/minimum
3085
3092
omitted from the root output unit.
3086
3093
</t >
3087
3094
<t >
3088
- Intermediate output units, which do not themselves produce errors but
3089
- represent subschemas that contain error-producing subschemas, MAY be
3090
- included .
3095
+ Output units which do not contain errors or annotations SHOULD be excluded
3096
+ from this format, however implementations MAY choose to include them for
3097
+ completeness .
3091
3098
</t >
3092
3099
<figure >
3093
3100
<artwork >
@@ -3125,78 +3132,72 @@ https://example.com/schemas/common#/$defs/count/minimum
3125
3132
}
3126
3133
]
3127
3134
}
3128
- ]]>
3129
- </artwork >
3130
- </figure >
3131
- </section >
3132
3135
3133
- <section title =" Detailed" >
3134
- <t >
3135
- The "Detailed" format is a hierarchical structure based on that of the schema
3136
- and can be more readable for both humans and machines by grouping together
3137
- output units that apply to the same subschemas.
3138
- </t >
3139
- <t >
3140
- The root output unit contains "valid" for the overall result and "nested"
3141
- for the list of specific results. All other information is explicitly
3142
- omitted from the root output unit.
3143
- </t >
3144
- <t >
3145
- The following rules govern the construction of the results object:
3146
- <list >
3147
- <t >
3148
- All applicator keywords ("*Of", "$ref", "if"/"then"/"else", etc.) require
3149
- a output unit.
3150
- </t >
3151
- <t >
3152
- Output units that have no children are removed.
3153
- </t >
3154
- <t >
3155
- Output units that have a single child are replaced by the child.
3156
- </t >
3157
- </list >
3158
- Branch output units do not require an error message or an annotation.
3159
- </t >
3160
- <figure >
3161
- <artwork >
3162
- <![CDATA[
3163
- // failing results
3136
+ // passing results
3164
3137
{
3165
- "valid": false ,
3138
+ "valid": true ,
3166
3139
"nested": [
3167
3140
{
3141
+ "valid": true,
3142
+ "evaluationPath": "",
3143
+ "schemaLocation":
3144
+ "https://json-schema.org/schemas/example#",
3145
+ "instanceLocation": "",
3146
+ "annotations": {
3147
+ "title": "root",
3148
+ "properties": [ "foo", "bar" ]
3149
+ }
3150
+ },
3151
+ {
3152
+ "valid": true,
3168
3153
"evaluationPath": "/properties/foo",
3169
3154
"schemaLocation":
3170
3155
"https://json-schema.org/schemas/example#/properties/foo",
3171
3156
"instanceLocation": "/foo",
3172
- "nested": [
3173
- {
3174
- "evaluationPath": "/properties/foo/allOf/0",
3175
- "schemaLocation":
3176
- "https://json-schema.org/schemas/example#/properties/foo/allOf/0",
3177
- "instanceLocation": "/foo",
3178
- "errors": {
3179
- "type": "Expected the property \"unspecified-prop\"."
3180
- }
3181
- },
3182
- {
3183
- "evaluationPath": "/properties/foo/allOf/1/properties/foo-prop",
3184
- "schemaLocation":
3185
- "https://json-schema.org/schemas/example#/properties/foo/allOf/1/properties/foo-prop",
3186
- "instanceLocation": "/foo/foo-prop",
3187
- "errors": {
3188
- "type": "Expected the value \"1\"."
3189
- }
3190
- }
3191
- ]
3157
+ "annotations": {
3158
+ "title": "foo-title"
3159
+ }
3160
+ },
3161
+ {
3162
+ "valid": true,
3163
+ "evaluationPath": "/properties/foo/allOf/1",
3164
+ "schemaLocation":
3165
+ "https://json-schema.org/schemas/example#/properties/foo/allOf/1",
3166
+ "instanceLocation": "/foo/foo-prop",
3167
+ "annotations": {
3168
+ "properties": [ "foo-prop" ],
3169
+ "additionalProperties": [ "unspecified-prop" ]
3170
+ }
3171
+ },
3172
+ {
3173
+ "valid": true,
3174
+ "evaluationPath": "/properties/foo/allOf/1/properties/foo-prop",
3175
+ "schemaLocation":
3176
+ "https://json-schema.org/schemas/example#/properties/foo/allOf/1/properties/foo-prop",
3177
+ "instanceLocation": "/foo/foo-prop",
3178
+ "annotations": {
3179
+ "title": "foo-prop-title"
3180
+ }
3192
3181
},
3193
3182
{
3183
+ "valid": true,
3184
+ "evaluationPath": "/properties/bar/$ref",
3185
+ "schemaLocation":
3186
+ "https://json-schema.org/schemas/example#/$defs/bar",
3187
+ "instanceLocation": "/bar",
3188
+ "annotations": {
3189
+ "title": "bar-title",
3190
+ "properties": [ "bar-prop" ]
3191
+ }
3192
+ },
3193
+ {
3194
+ "valid": true,
3194
3195
"evaluationPath": "/properties/bar/$ref/properties/bar-prop",
3195
3196
"schemaLocation":
3196
3197
"https://json-schema.org/schemas/example#/$defs/bar/properties/bar-prop",
3197
3198
"instanceLocation": "/bar/bar-prop",
3198
- "errors ": {
3199
- "type ": "Expected a value of type \"integer\". "
3199
+ "annotations ": {
3200
+ "title ": "bar-prop-title "
3200
3201
}
3201
3202
}
3202
3203
]
@@ -3206,23 +3207,24 @@ https://example.com/schemas/common#/$defs/count/minimum
3206
3207
</figure >
3207
3208
</section >
3208
3209
3209
- <section title =" Verbose" >
3210
+ <section title =" Hierarchical" >
3211
+ <t >
3212
+ The "Hierarchical" structure is a tree structure that follows the
3213
+ evaluation path during the validation process. Typically, it will
3214
+ resemble the schema as if all referenced schemas were bundled in place
3215
+ of their associated by-reference keywords.
3216
+ </t >
3210
3217
<t >
3211
- The "Verbose" structure is a fully realized hierarchy that exactly matches
3212
- that of the schema. This structure has applications in form generation and
3213
- validation where the error's location is important.
3218
+ All output units are included in this format.
3214
3219
</t >
3215
3220
<t >
3216
- The primary difference between this and the "Detailed" structure is that
3217
- all results are returned. This includes subschema validation results that
3218
- would otherwise be removed (e.g. passing subschemas contained within failing
3219
- subschemas, etc.). Because of this, each output unit MUST also carry a
3220
- "valid" property to indicate its local validation result.
3221
+ The location properties of the output unit MAY be omitted from the
3222
+ root node.
3221
3223
</t >
3222
3224
<figure >
3223
3225
<artwork >
3224
3226
<![CDATA[
3225
- // failing results
3227
+ // failing results (errors)
3226
3228
{
3227
3229
"valid": false,
3228
3230
"nested": [
@@ -3294,7 +3296,92 @@ https://example.com/schemas/common#/$defs/count/minimum
3294
3296
}
3295
3297
]
3296
3298
}
3297
- ]]>
3299
+
3300
+ // passing results (annotations)
3301
+ {
3302
+ "valid": true,
3303
+ "annotations": {
3304
+ "title": "root",
3305
+ "properties": [ "foo", "bar" ]
3306
+ },
3307
+ "nested": [
3308
+ {
3309
+ "valid": true,
3310
+ "evaluationPath": "/properties/foo",
3311
+ "schemaLocation":
3312
+ "https://json-schema.org/schemas/example#/properties/foo",
3313
+ "instanceLocation": "/foo",
3314
+ "annotations": {
3315
+ "title": "foo-title"
3316
+ },
3317
+ "nested": [
3318
+ {
3319
+ "valid": true,
3320
+ "evaluationPath": "/properties/foo/allOf/0",
3321
+ "schemaLocation":
3322
+ "https://json-schema.org/schemas/example#/properties/foo/allOf/0",
3323
+ "instanceLocation": "/foo"
3324
+ },
3325
+ {
3326
+ "valid": true,
3327
+ "evaluationPath": "/properties/foo/allOf/1",
3328
+ "schemaLocation":
3329
+ "https://json-schema.org/schemas/example#/properties/foo/allOf/1",
3330
+ "instanceLocation": "/foo/foo-prop",
3331
+ "annotations": {
3332
+ "properties": [ "foo-prop" ],
3333
+ "additionalProperties": [ "unspecified-prop" ]
3334
+ },
3335
+ "nested": [
3336
+ {
3337
+ "valid": true,
3338
+ "evaluationPath": "/properties/foo/allOf/1/properties/foo-prop",
3339
+ "schemaLocation":
3340
+ "https://json-schema.org/schemas/example#/properties/foo/allOf/1/properties/foo-prop",
3341
+ "instanceLocation": "/foo/foo-prop",
3342
+ "annotations": {
3343
+ "title": "foo-prop-title"
3344
+ }
3345
+ }
3346
+ ]
3347
+ }
3348
+ ]
3349
+ },
3350
+ {
3351
+ "valid": true,
3352
+ "evaluationPath": "/properties/bar",
3353
+ "schemaLocation":
3354
+ "https://json-schema.org/schemas/example#/properties/bar",
3355
+ "instanceLocation": "/bar",
3356
+ "nested": [
3357
+ {
3358
+ "valid": true,
3359
+ "evaluationPath": "/properties/bar/$ref",
3360
+ "schemaLocation":
3361
+ "https://json-schema.org/schemas/example#/$defs/bar",
3362
+ "instanceLocation": "/bar",
3363
+ "annotations": {
3364
+ "title": "bar-title",
3365
+ "properties": [ "bar-prop" ]
3366
+ },
3367
+ "nested": [
3368
+ {
3369
+ "valid": true,
3370
+ "evaluationPath": "/properties/bar/$ref/properties/bar-prop",
3371
+ "schemaLocation":
3372
+ "https://json-schema.org/schemas/example#/$defs/bar/properties/bar-prop",
3373
+ "instanceLocation": "/bar/bar-prop",
3374
+ "annotations": {
3375
+ "title": "bar-prop-title"
3376
+ }
3377
+ }
3378
+ ]
3379
+ }
3380
+ ]
3381
+ }
3382
+ ]
3383
+ }
3384
+ ]]>
3298
3385
</artwork >
3299
3386
</figure >
3300
3387
</section >
0 commit comments