Skip to content

Commit 147df48

Browse files
committed
add output schemas
1 parent fe25ba9 commit 147df48

File tree

3 files changed

+287
-0
lines changed

3 files changed

+287
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/next/schema",
3+
"$id": "https://json-schema.org/draft/next/output/schema",
4+
"description": "A schema that validates the minimum requirements for validation output",
5+
6+
"anyOf": [
7+
{ "$ref": "#/$defs/flag" },
8+
{ "$ref": "#/$defs/basic" },
9+
{ "$ref": "#/$defs/hierarchical" }
10+
],
11+
"$defs": {
12+
"outputUnit":{
13+
"properties": {
14+
"valid": { "type": "boolean" },
15+
"evaluationPath": {
16+
"type": "string",
17+
"format": "json-pointer"
18+
},
19+
"schemaLocation": {
20+
"type": "string",
21+
"format": "uri"
22+
},
23+
"instanceLocation": {
24+
"type": "string",
25+
"format": "json-pointer"
26+
},
27+
"details": {
28+
"$ref": "#/$defs/outputUnitArray"
29+
},
30+
"annotations": {
31+
"type": "object",
32+
"additionalProperties": true
33+
},
34+
"droppedAnnotations": {
35+
"type": "object",
36+
"additionalProperties": true
37+
},
38+
"errors": {
39+
"type": "object",
40+
"additionalProperties": { "type": "string" }
41+
}
42+
},
43+
"required": [ "valid", "evaluationPath", "schemaLocation", "instanceLocation" ],
44+
"allOf": [
45+
{
46+
"if": {
47+
"anyOf": [
48+
{
49+
"required": [ "errors" ]
50+
},
51+
{
52+
"required": [ "droppedAnnotations" ]
53+
}
54+
]
55+
},
56+
"then": {
57+
"properties": {
58+
"valid": { "const": false }
59+
}
60+
}
61+
},
62+
{
63+
"if": {
64+
"required": [ "annotations" ]
65+
},
66+
"then": {
67+
"properties": {
68+
"valid": { "const": true }
69+
}
70+
}
71+
}
72+
]
73+
},
74+
"outputUnitArray": {
75+
"type": "array",
76+
"items": { "$ref": "#/$defs/outputUnit" }
77+
},
78+
"flag": {
79+
"properties": {
80+
"valid": { "type": "boolean" }
81+
},
82+
"required": [ "valid" ]
83+
},
84+
"basic": {
85+
"properties": {
86+
"valid": { "type": "boolean" },
87+
"details": {
88+
"$ref": "#/$defs/outputUnitArray"
89+
}
90+
},
91+
"required": [ "valid", "details" ]
92+
},
93+
"hierarchical": { "$ref": "#/$defs/outputUnit" }
94+
}
95+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2019-09/schema",
3+
"$id": "https://json-schema.org/draft/2019-09/output/schema",
4+
"description": "A schema that validates the minimum requirements for validation output",
5+
6+
"anyOf": [
7+
{ "$ref": "#/$defs/flag" },
8+
{ "$ref": "#/$defs/basic" },
9+
{ "$ref": "#/$defs/detailed" },
10+
{ "$ref": "#/$defs/verbose" }
11+
],
12+
"$defs": {
13+
"outputUnit":{
14+
"properties": {
15+
"valid": { "type": "boolean" },
16+
"keywordLocation": {
17+
"type": "string",
18+
"format": "json-pointer"
19+
},
20+
"absoluteKeywordLocation": {
21+
"type": "string",
22+
"format": "uri"
23+
},
24+
"instanceLocation": {
25+
"type": "string",
26+
"format": "json-pointer"
27+
},
28+
"error": {
29+
"type": "string"
30+
},
31+
"errors": {
32+
"$ref": "#/$defs/outputUnitArray"
33+
},
34+
"annotations": {
35+
"$ref": "#/$defs/outputUnitArray"
36+
}
37+
},
38+
"required": [ "valid", "keywordLocation", "instanceLocation" ],
39+
"allOf": [
40+
{
41+
"if": {
42+
"properties": {
43+
"valid": { "const": false }
44+
}
45+
},
46+
"then": {
47+
"anyOf": [
48+
{
49+
"required": [ "error" ]
50+
},
51+
{
52+
"required": [ "errors" ]
53+
}
54+
]
55+
}
56+
},
57+
{
58+
"if": {
59+
"anyOf": [
60+
{
61+
"properties": {
62+
"keywordLocation": {
63+
"pattern": "/\\$ref/"
64+
}
65+
}
66+
},
67+
{
68+
"properties": {
69+
"keywordLocation": {
70+
"pattern": "/\\$dynamicRef/"
71+
}
72+
}
73+
}
74+
]
75+
},
76+
"then": {
77+
"required": [ "absoluteKeywordLocation" ]
78+
}
79+
}
80+
]
81+
},
82+
"outputUnitArray": {
83+
"type": "array",
84+
"items": { "$ref": "#/$defs/outputUnit" }
85+
},
86+
"flag": {
87+
"properties": {
88+
"valid": { "type": "boolean" }
89+
},
90+
"required": [ "valid" ]
91+
},
92+
"basic": { "$ref": "#/$defs/outputUnit" },
93+
"detailed": { "$ref": "#/$defs/outputUnit" },
94+
"verbose": { "$ref": "#/$defs/outputUnit" }
95+
}
96+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://json-schema.org/draft/2020-12/output/schema",
4+
"description": "A schema that validates the minimum requirements for validation output",
5+
6+
"anyOf": [
7+
{ "$ref": "#/$defs/flag" },
8+
{ "$ref": "#/$defs/basic" },
9+
{ "$ref": "#/$defs/detailed" },
10+
{ "$ref": "#/$defs/verbose" }
11+
],
12+
"$defs": {
13+
"outputUnit":{
14+
"properties": {
15+
"valid": { "type": "boolean" },
16+
"keywordLocation": {
17+
"type": "string",
18+
"format": "json-pointer"
19+
},
20+
"absoluteKeywordLocation": {
21+
"type": "string",
22+
"format": "uri"
23+
},
24+
"instanceLocation": {
25+
"type": "string",
26+
"format": "json-pointer"
27+
},
28+
"error": {
29+
"type": "string"
30+
},
31+
"errors": {
32+
"$ref": "#/$defs/outputUnitArray"
33+
},
34+
"annotations": {
35+
"$ref": "#/$defs/outputUnitArray"
36+
}
37+
},
38+
"required": [ "valid", "keywordLocation", "instanceLocation" ],
39+
"allOf": [
40+
{
41+
"if": {
42+
"properties": {
43+
"valid": { "const": false }
44+
}
45+
},
46+
"then": {
47+
"anyOf": [
48+
{
49+
"required": [ "error" ]
50+
},
51+
{
52+
"required": [ "errors" ]
53+
}
54+
]
55+
}
56+
},
57+
{
58+
"if": {
59+
"anyOf": [
60+
{
61+
"properties": {
62+
"keywordLocation": {
63+
"pattern": "/\\$ref/"
64+
}
65+
}
66+
},
67+
{
68+
"properties": {
69+
"keywordLocation": {
70+
"pattern": "/\\$dynamicRef/"
71+
}
72+
}
73+
}
74+
]
75+
},
76+
"then": {
77+
"required": [ "absoluteKeywordLocation" ]
78+
}
79+
}
80+
]
81+
},
82+
"outputUnitArray": {
83+
"type": "array",
84+
"items": { "$ref": "#/$defs/outputUnit" }
85+
},
86+
"flag": {
87+
"properties": {
88+
"valid": { "type": "boolean" }
89+
},
90+
"required": [ "valid" ]
91+
},
92+
"basic": { "$ref": "#/$defs/outputUnit" },
93+
"detailed": { "$ref": "#/$defs/outputUnit" },
94+
"verbose": { "$ref": "#/$defs/outputUnit" }
95+
}
96+
}

0 commit comments

Comments
 (0)