2672
2672
Basic - Provides validation information in a flat list structure.
2673
2673
</t >
2674
2674
<t >
2675
- Detailed - Provides validation information in a condensed hierarchical
2676
- structure based on the structure of the schema.
2677
- </t >
2678
- <t >
2679
- Verbose - Provides validation information in an uncondensed hierarchical
2680
- structure that matches the exact structure of the schema.
2675
+ Hierarchical - Provides validation information in a hierarchical
2676
+ structure that mimics the structure of the schema.
2677
+ <cref >
2678
+ To be precise, this structure follows the paths that a validator
2679
+ would traverse while processing the schema, including composition
2680
+ via by-reference keywords.
2681
+ </cref >
2681
2682
</t >
2682
2683
</list >
2683
- An implementation SHOULD provide at least one of the "flag", "basic", or "detailed"
2684
- format and MAY provide the "verbose" format. If it provides one or more of the
2685
- "detailed" or "verbose" formats, it MUST also provide the "flag" format.
2686
- Implementations SHOULD specify in their documentation which formats they support.
2684
+ An implementation MUST provide the "flag" format and SHOULD provide at least one
2685
+ of the "basic" or "hierarchical" formats. Implementations SHOULD specify in
2686
+ their documentation which formats they support.
2687
2687
</t >
2688
2688
2689
2689
</section >
@@ -2770,7 +2770,7 @@ https://example.com/schemas/common#/$defs/count/minimum
2770
2770
<t >
2771
2771
Any errors produced by the validation. This property MUST NOT
2772
2772
be included if the validation was successful. The value
2773
- for this property is an object where the keys are the names of
2773
+ for this property MUST be an object where the keys are the names of
2774
2774
keywords and the values are the error message produced by the
2775
2775
associated keyword. If the subschema itself is producing the
2776
2776
error, that error MUST be listed with an empty string key.
@@ -2788,7 +2788,7 @@ https://example.com/schemas/common#/$defs/count/minimum
2788
2788
<t >
2789
2789
Any annotations produced by the validation. This property MUST NOT
2790
2790
be included if the validation was unsuccessful. The value
2791
- for this property is an object where the keys are the names of
2791
+ for this property MUST be an object where the keys are the names of
2792
2792
keywords and the values are the annotations produced by the
2793
2793
associated keyword.
2794
2794
</t >
@@ -2802,13 +2802,20 @@ https://example.com/schemas/common#/$defs/count/minimum
2802
2802
</section >
2803
2803
2804
2804
<section title =" Nested Results" >
2805
+ <t >
2806
+ Nested results are generated from applicator keywords: keywords with
2807
+ subschemas or collections of subschemas as values. Keywords which
2808
+ have arrays of subschemas (e.g. "anyOf") will generally generate an output
2809
+ unit for each subschema. In order to accommodate potentially multiple
2810
+ results, the value of this property MUST be an array of output units.
2811
+ </t >
2805
2812
<t >
2806
2813
For "basic", this property will appear only at the root output unit
2807
- and will hold all results in a flat list.
2814
+ and will hold all output units in a flat list.
2808
2815
</t >
2809
2816
<t >
2810
- For "detailed" and "verbose" , this property will hold nested results
2811
- in a tree structure, mimicking that of the schema.
2817
+ For "hierarchical" , this property will hold nested results in a tree
2818
+ structure, mimicking that of the schema.
2812
2819
</t >
2813
2820
<t >
2814
2821
The sequence of output units within this list is not specified and
@@ -2962,18 +2969,18 @@ https://example.com/schemas/common#/$defs/count/minimum
2962
2969
by following the path "/properties/foo/allOf/1"
2963
2970
will produce <sourcecode >["foo-prop"]</sourcecode >.
2964
2971
</t >
2965
- <t >
2966
- The keyword "title"
2967
- validated at "/properties/foo/allOf/1/properties/foo-prop"
2968
- by following the path "/properties/foo/allOf/1/properties/foo-prop"
2969
- will produce <sourcecode >"foo-prop-title"</sourcecode >.
2970
- </t >
2971
2972
<t >
2972
2973
The keyword "additionalProperties"
2973
2974
validated at "/properties/foo/allOf/1"
2974
2975
by following the path "/properties/foo/allOf/1"
2975
2976
will produce <sourcecode >["unspecified-prop"]</sourcecode >.
2976
2977
</t >
2978
+ <t >
2979
+ The keyword "title"
2980
+ validated at "/properties/foo/allOf/1/properties/foo-prop"
2981
+ by following the path "/properties/foo/allOf/1/properties/foo-prop"
2982
+ will produce <sourcecode >"foo-prop-title"</sourcecode >.
2983
+ </t >
2977
2984
<t >
2978
2985
The keyword "title"
2979
2986
validated at "/$defs/bar"
@@ -3031,9 +3038,9 @@ https://example.com/schemas/common#/$defs/count/minimum
3031
3038
omitted from the root output unit.
3032
3039
</t >
3033
3040
<t >
3034
- Intermediate output units, which do not themselves produce errors but
3035
- represent subschemas that contain error-producing subschemas, MAY be
3036
- included .
3041
+ Output units which do not contain errors or annotations SHOULD be excluded
3042
+ from this format, however implementations MAY choose to include them for
3043
+ completeness .
3037
3044
</t >
3038
3045
<figure >
3039
3046
<artwork >
@@ -3071,78 +3078,72 @@ https://example.com/schemas/common#/$defs/count/minimum
3071
3078
}
3072
3079
]
3073
3080
}
3074
- ]]>
3075
- </artwork >
3076
- </figure >
3077
- </section >
3078
3081
3079
- <section title =" Detailed" >
3080
- <t >
3081
- The "Detailed" format is a hierarchical structure based on that of the schema
3082
- and can be more readable for both humans and machines by grouping together
3083
- output units that apply to the same subschemas.
3084
- </t >
3085
- <t >
3086
- The root output unit contains "valid" for the overall result and "nested"
3087
- for the list of specific results. All other information is explicitly
3088
- omitted from the root output unit.
3089
- </t >
3090
- <t >
3091
- The following rules govern the construction of the results object:
3092
- <list >
3093
- <t >
3094
- All applicator keywords ("*Of", "$ref", "if"/"then"/"else", etc.) require
3095
- a output unit.
3096
- </t >
3097
- <t >
3098
- Output units that have no children are removed.
3099
- </t >
3100
- <t >
3101
- Output units that have a single child are replaced by the child.
3102
- </t >
3103
- </list >
3104
- Branch output units do not require an error message or an annotation.
3105
- </t >
3106
- <figure >
3107
- <artwork >
3108
- <![CDATA[
3109
- // failing results
3082
+ // passing results
3110
3083
{
3111
- "valid": false ,
3084
+ "valid": true ,
3112
3085
"nested": [
3113
3086
{
3087
+ "valid": true,
3088
+ "evaluationPath": "",
3089
+ "schemaLocation":
3090
+ "https://json-schema.org/schemas/example#",
3091
+ "instanceLocation": "",
3092
+ "annotations": {
3093
+ "title": "root",
3094
+ "properties": [ "foo", "bar" ]
3095
+ }
3096
+ },
3097
+ {
3098
+ "valid": true,
3114
3099
"evaluationPath": "/properties/foo",
3115
3100
"schemaLocation":
3116
3101
"https://json-schema.org/schemas/example#/properties/foo",
3117
3102
"instanceLocation": "/foo",
3118
- "nested": [
3119
- {
3120
- "evaluationPath": "/properties/foo/allOf/0",
3121
- "schemaLocation":
3122
- "https://json-schema.org/schemas/example#/properties/foo/allOf/0",
3123
- "instanceLocation": "/foo",
3124
- "errors": {
3125
- "type": "Expected the property \"unspecified-prop\"."
3126
- }
3127
- },
3128
- {
3129
- "evaluationPath": "/properties/foo/allOf/1/properties/foo-prop",
3130
- "schemaLocation":
3131
- "https://json-schema.org/schemas/example#/properties/foo/allOf/1/properties/foo-prop",
3132
- "instanceLocation": "/foo/foo-prop",
3133
- "errors": {
3134
- "type": "Expected the value \"1\"."
3135
- }
3136
- }
3137
- ]
3103
+ "annotations": {
3104
+ "title": "foo-title"
3105
+ }
3106
+ },
3107
+ {
3108
+ "valid": true,
3109
+ "evaluationPath": "/properties/foo/allOf/1",
3110
+ "schemaLocation":
3111
+ "https://json-schema.org/schemas/example#/properties/foo/allOf/1",
3112
+ "instanceLocation": "/foo/foo-prop",
3113
+ "annotations": {
3114
+ "properties": [ "foo-prop" ],
3115
+ "additionalProperties": [ "unspecified-prop" ]
3116
+ }
3117
+ },
3118
+ {
3119
+ "valid": true,
3120
+ "evaluationPath": "/properties/foo/allOf/1/properties/foo-prop",
3121
+ "schemaLocation":
3122
+ "https://json-schema.org/schemas/example#/properties/foo/allOf/1/properties/foo-prop",
3123
+ "instanceLocation": "/foo/foo-prop",
3124
+ "annotations": {
3125
+ "title": "foo-prop-title"
3126
+ }
3138
3127
},
3139
3128
{
3129
+ "valid": true,
3130
+ "evaluationPath": "/properties/bar/$ref",
3131
+ "schemaLocation":
3132
+ "https://json-schema.org/schemas/example#/$defs/bar",
3133
+ "instanceLocation": "/bar",
3134
+ "annotations": {
3135
+ "title": "bar-title",
3136
+ "properties": [ "bar-prop" ]
3137
+ }
3138
+ },
3139
+ {
3140
+ "valid": true,
3140
3141
"evaluationPath": "/properties/bar/$ref/properties/bar-prop",
3141
3142
"schemaLocation":
3142
3143
"https://json-schema.org/schemas/example#/$defs/bar/properties/bar-prop",
3143
3144
"instanceLocation": "/bar/bar-prop",
3144
- "errors ": {
3145
- "type ": "Expected a value of type \"integer\". "
3145
+ "annotations ": {
3146
+ "title ": "bar-prop-title "
3146
3147
}
3147
3148
}
3148
3149
]
@@ -3152,23 +3153,24 @@ https://example.com/schemas/common#/$defs/count/minimum
3152
3153
</figure >
3153
3154
</section >
3154
3155
3155
- <section title =" Verbose" >
3156
+ <section title =" Hierarchical" >
3157
+ <t >
3158
+ The "Hierarchical" structure is a tree structure that follows the
3159
+ evaluation path during the validation process. Typically, it will
3160
+ resemble the schema as if all referenced schemas were bundled in place
3161
+ of their associated by-reference keywords.
3162
+ </t >
3156
3163
<t >
3157
- The "Verbose" structure is a fully realized hierarchy that exactly matches
3158
- that of the schema. This structure has applications in form generation and
3159
- validation where the error's location is important.
3164
+ All output units are included in this format.
3160
3165
</t >
3161
3166
<t >
3162
- The primary difference between this and the "Detailed" structure is that
3163
- all results are returned. This includes subschema validation results that
3164
- would otherwise be removed (e.g. passing subschemas contained within failing
3165
- subschemas, etc.). Because of this, each output unit MUST also carry a
3166
- "valid" property to indicate its local validation result.
3167
+ The location properties of the output unit MAY be omitted from the
3168
+ root node.
3167
3169
</t >
3168
3170
<figure >
3169
3171
<artwork >
3170
3172
<![CDATA[
3171
- // failing results
3173
+ // failing results (errors)
3172
3174
{
3173
3175
"valid": false,
3174
3176
"nested": [
@@ -3240,7 +3242,92 @@ https://example.com/schemas/common#/$defs/count/minimum
3240
3242
}
3241
3243
]
3242
3244
}
3243
- ]]>
3245
+
3246
+ // passing results (annotations)
3247
+ {
3248
+ "valid": true,
3249
+ "annotations": {
3250
+ "title": "root",
3251
+ "properties": [ "foo", "bar" ]
3252
+ },
3253
+ "nested": [
3254
+ {
3255
+ "valid": true,
3256
+ "evaluationPath": "/properties/foo",
3257
+ "schemaLocation":
3258
+ "https://json-schema.org/schemas/example#/properties/foo",
3259
+ "instanceLocation": "/foo",
3260
+ "annotations": {
3261
+ "title": "foo-title"
3262
+ },
3263
+ "nested": [
3264
+ {
3265
+ "valid": true,
3266
+ "evaluationPath": "/properties/foo/allOf/0",
3267
+ "schemaLocation":
3268
+ "https://json-schema.org/schemas/example#/properties/foo/allOf/0",
3269
+ "instanceLocation": "/foo"
3270
+ },
3271
+ {
3272
+ "valid": true,
3273
+ "evaluationPath": "/properties/foo/allOf/1",
3274
+ "schemaLocation":
3275
+ "https://json-schema.org/schemas/example#/properties/foo/allOf/1",
3276
+ "instanceLocation": "/foo/foo-prop",
3277
+ "annotations": {
3278
+ "properties": [ "foo-prop" ],
3279
+ "additionalProperties": [ "unspecified-prop" ]
3280
+ },
3281
+ "nested": [
3282
+ {
3283
+ "valid": true,
3284
+ "evaluationPath": "/properties/foo/allOf/1/properties/foo-prop",
3285
+ "schemaLocation":
3286
+ "https://json-schema.org/schemas/example#/properties/foo/allOf/1/properties/foo-prop",
3287
+ "instanceLocation": "/foo/foo-prop",
3288
+ "annotations": {
3289
+ "title": "foo-prop-title"
3290
+ }
3291
+ }
3292
+ ]
3293
+ }
3294
+ ]
3295
+ },
3296
+ {
3297
+ "valid": true,
3298
+ "evaluationPath": "/properties/bar",
3299
+ "schemaLocation":
3300
+ "https://json-schema.org/schemas/example#/properties/bar",
3301
+ "instanceLocation": "/bar",
3302
+ "nested": [
3303
+ {
3304
+ "valid": true,
3305
+ "evaluationPath": "/properties/bar/$ref",
3306
+ "schemaLocation":
3307
+ "https://json-schema.org/schemas/example#/$defs/bar",
3308
+ "instanceLocation": "/bar",
3309
+ "annotations": {
3310
+ "title": "bar-title",
3311
+ "properties": [ "bar-prop" ]
3312
+ },
3313
+ "nested": [
3314
+ {
3315
+ "valid": true,
3316
+ "evaluationPath": "/properties/bar/$ref/properties/bar-prop",
3317
+ "schemaLocation":
3318
+ "https://json-schema.org/schemas/example#/$defs/bar/properties/bar-prop",
3319
+ "instanceLocation": "/bar/bar-prop",
3320
+ "annotations": {
3321
+ "title": "bar-prop-title"
3322
+ }
3323
+ }
3324
+ ]
3325
+ }
3326
+ ]
3327
+ }
3328
+ ]
3329
+ }
3330
+ ]]>
3244
3331
</artwork >
3245
3332
</figure >
3246
3333
</section >
0 commit comments