summaryrefslogtreecommitdiff
path: root/json/output-tests
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-12-19 15:10:11 -0500
committerJulian Berman <Julian@GrayVines.com>2022-12-19 15:10:11 -0500
commit8b8d986e5a42a09cc87ed8fd1d7d3d7ee19a929d (patch)
tree4ad4ba321f5e3c258728eff95bcc0541fa0372fd /json/output-tests
parent7b1bdb43e7e6f350fe183f6857f4295ce591d942 (diff)
parentade1faa768471bb95b14533f20a504fe8fc326c9 (diff)
downloadjsonschema-8b8d986e5a42a09cc87ed8fd1d7d3d7ee19a929d.tar.gz
Merge commit 'ade1faa768471bb95b14533f20a504fe8fc326c9'
* commit 'ade1faa768471bb95b14533f20a504fe8fc326c9': Squashed 'json/' changes from 78c888273..6b3cac42b
Diffstat (limited to 'json/output-tests')
-rw-r--r--json/output-tests/README.md63
-rw-r--r--json/output-tests/draft-next/content/general.json43
-rw-r--r--json/output-tests/draft-next/content/readOnly.json41
-rw-r--r--json/output-tests/draft-next/content/type.json39
-rw-r--r--json/output-tests/draft-next/output-schema.json95
-rw-r--r--json/output-tests/draft2019-09/content/general.json34
-rw-r--r--json/output-tests/draft2019-09/content/readOnly.json38
-rw-r--r--json/output-tests/draft2019-09/content/type.json63
-rw-r--r--json/output-tests/draft2019-09/output-schema.json96
-rw-r--r--json/output-tests/draft2020-12/content/general.json34
-rw-r--r--json/output-tests/draft2020-12/content/readOnly.json37
-rw-r--r--json/output-tests/draft2020-12/content/type.json63
-rw-r--r--json/output-tests/draft2020-12/output-schema.json96
13 files changed, 742 insertions, 0 deletions
diff --git a/json/output-tests/README.md b/json/output-tests/README.md
new file mode 100644
index 0000000..0cd7c87
--- /dev/null
+++ b/json/output-tests/README.md
@@ -0,0 +1,63 @@
+These tests are intended to validate that implementations are correctly generating output in accordance with the specification.
+
+Output was initially specified with draft 2019-09. It remained largely unchanged for draft 2020-12, but will receive an update with the next release.
+
+***NOTE** Although the formats didn't change between 2019-09 and 2020-12, the tests are replicated for 2020-12 because the `$schema` is different and implementations may (but shouldn't) produce different output.*
+
+## Organization
+
+The tests are organized by specification release and then into two categories: content and structure.
+
+Content tests verify that the keywords are producing the correct annotations and/or error messages. Since there are no requirements on the content of error messages, there's not much that can be verified for them, but it is possible to identify when a error message _could_ be present. Primarily, these tests need to extensively cover the annotation behaviors of each keyword. The only output format needed for these tests is `basic` for 2019-09/2020/12 and `list` for later versions.
+
+Structure tests verify that the structures of the various formats (i.e. `flag`, `basic`, `detailed`, `verbose` for 2019/2020 and `flag`, `list`, `hierarchical` for later versions) are correct. These tests don't need to cover each keyword; rather they need to sufficiently cover the various aspects of building the output structures by using whatever keywords are necessary to do so.
+
+In each release folder, you'll also find an _output-schema.json_ file that contains the schema from the specification repo that describes output for that release. This schema will need to be loaded as the tests reference it.
+
+## Test Files
+
+The content of a test file is the same as the validation tests in `tests/`, however an `output` property has been added to each test case.
+
+The `output` property itself has a property for each of the output formats where the value is a schema that will successfully validate for compliant output. For the content tests, only `basic`/`list` needs to be present.
+
+## Other notes
+
+### Ambiguity around 2020-09/2020-12 `basic`
+
+The 2019-09/2020-12 specs don't define the structure of `basic` very thoroughly. Specifically there is a nuance where if the list contains a single output node, there are two possible structures, given the text:
+
+- the output node for the root schema appears in the list with a containing node that just has a `valid` property
+ ```json
+ {
+ "valid": false,
+ "errors": [
+ {
+ "valid": false,
+ "keywordLocation": "",
+ "absoluteKeywordLocation": "https://json-schema.org/tests/content/draft2019-09/general/0",
+ "instanceLocation": ""
+ }
+ ]
+ }
+ ```
+- the entire structure is collapsed to just the root output node as `detailed` would do.
+ ```json
+ {
+ "valid": false,
+ "keywordLocation": "",
+ "absoluteKeywordLocation": "https://json-schema.org/tests/content/draft2019-09/general/0",
+ "instanceLocation": ""
+ }
+ ```
+As the Test Suite should not prefer one interpretation over another, these cases need to be tested another way.
+
+A simple solution (though there are likely others) is to force a second output unit by adding an `"anyOf": [ true ]`. This has no impact on the validation result while adding superfluous structure to the output that avoids the above ambiguous scenario. The test schema should still be targeted on what's being tested and ignore any output units generated by this extra keyword.
+
+## Contributing
+
+Of course, first and foremost, follow the [Contributing guide](/CONTRIBUTING.md).
+
+When writing test cases, try to keep output validation schemas targeted to verify a single requirement. Where possible (and where it makes sense), create multiple tests to cover multiple requirements. This will help keep the output validation schemas small and increase readability. (It also increases your test count. 😉)
+
+For the content tests, there is also a _general.json_ file that contains tests that do not necessarily pertain to any single keyword.
+<!-- This general.json file may be added to the structure tests later, but I haven't gotten to them yet, so I don't know. -->
diff --git a/json/output-tests/draft-next/content/general.json b/json/output-tests/draft-next/content/general.json
new file mode 100644
index 0000000..27082ed
--- /dev/null
+++ b/json/output-tests/draft-next/content/general.json
@@ -0,0 +1,43 @@
+[
+ {
+ "description": "failed validation produces no annotations",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$id": "https://json-schema.org/tests/content/draft-next/general/0",
+ "type": "string",
+ "readOnly": true
+ },
+ "tests": [
+ {
+ "description": "dropped annotations MAY appear in droppedAnnotations",
+ "data": 1,
+ "output": {
+ "list": {
+ "$id": "https://json-schema.org/tests/content/draft-next/general/0/tests/0/basic",
+ "$ref": "/draft/next/output/schema",
+ "properties": {
+ "details": {
+ "contains": {
+ "properties": {
+ "evaluationPath": {"const": ""},
+ "schemaLocation": {"const": "https://json-schema.org/tests/content/draft-next/general/0"},
+ "instanceLocation": {"const": ""},
+ "annotations": false,
+ "droppedAnnotations": {
+ "properties": {
+ "readOnly": {"const": true}
+ },
+ "required": ["readOnly"]
+ }
+ },
+ "required": ["evaluationPath", "schemaLocation", "instanceLocation"]
+ }
+ }
+ },
+ "required": ["details"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/output-tests/draft-next/content/readOnly.json b/json/output-tests/draft-next/content/readOnly.json
new file mode 100644
index 0000000..d387d93
--- /dev/null
+++ b/json/output-tests/draft-next/content/readOnly.json
@@ -0,0 +1,41 @@
+[
+ {
+ "description": "readOnly generates its value as an annotation",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$id": "https://json-schema.org/tests/content/draft-next/readOnly/0",
+ "readOnly": true
+ },
+ "tests": [
+ {
+ "description": "readOnly is true",
+ "data": 1,
+ "output": {
+ "list": {
+ "$id": "https://json-schema.org/tests/content/draft-next/readOnly/0/tests/0/basic",
+ "$ref": "/draft/next/output/schema",
+ "properties": {
+ "details": {
+ "contains": {
+ "properties": {
+ "evaluationPath": {"const": ""},
+ "schemaLocation": {"const": "https://json-schema.org/tests/content/draft-next/readOnly/0"},
+ "instanceLocation": {"const": ""},
+ "annotations": {
+ "properties": {
+ "readOnly": {"const": true}
+ },
+ "required": ["readOnly"]
+ }
+ },
+ "required": ["evaluationPath", "schemaLocation", "instanceLocation", "annotations"]
+ }
+ }
+ },
+ "required": ["details"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/output-tests/draft-next/content/type.json b/json/output-tests/draft-next/content/type.json
new file mode 100644
index 0000000..e17f1f5
--- /dev/null
+++ b/json/output-tests/draft-next/content/type.json
@@ -0,0 +1,39 @@
+[
+ {
+ "description": "incorrect type",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$id": "https://json-schema.org/tests/content/draft-next/type/0",
+ "type": "string"
+ },
+ "tests": [
+ {
+ "description": "incorrect type must be reported, but a message is not required",
+ "data": 1,
+ "output": {
+ "list": {
+ "$id": "https://json-schema.org/tests/content/draft-next/type/0/tests/0/basic",
+ "$ref": "/draft/next/output/schema",
+ "properties": {
+ "details": {
+ "contains": {
+ "properties": {
+ "evaluationPath": {"const": ""},
+ "schemaLocation": {"const": "https://json-schema.org/tests/content/draft-next/type/0"},
+ "instanceLocation": {"const": ""},
+ "annotations": false,
+ "errors": {
+ "required": ["type"]
+ }
+ },
+ "required": ["evaluationPath", "schemaLocation", "instanceLocation"]
+ }
+ }
+ },
+ "required": ["details"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/output-tests/draft-next/output-schema.json b/json/output-tests/draft-next/output-schema.json
new file mode 100644
index 0000000..26286fa
--- /dev/null
+++ b/json/output-tests/draft-next/output-schema.json
@@ -0,0 +1,95 @@
+{
+ "$schema": "https://json-schema.org/draft/next/schema",
+ "$id": "https://json-schema.org/draft/next/output/schema",
+ "description": "A schema that validates the minimum requirements for validation output",
+
+ "anyOf": [
+ { "$ref": "#/$defs/flag" },
+ { "$ref": "#/$defs/basic" },
+ { "$ref": "#/$defs/hierarchical" }
+ ],
+ "$defs": {
+ "outputUnit":{
+ "properties": {
+ "valid": { "type": "boolean" },
+ "evaluationPath": {
+ "type": "string",
+ "format": "json-pointer"
+ },
+ "schemaLocation": {
+ "type": "string",
+ "format": "uri"
+ },
+ "instanceLocation": {
+ "type": "string",
+ "format": "json-pointer"
+ },
+ "details": {
+ "$ref": "#/$defs/outputUnitArray"
+ },
+ "annotations": {
+ "type": "object",
+ "additionalProperties": true
+ },
+ "droppedAnnotations": {
+ "type": "object",
+ "additionalProperties": true
+ },
+ "errors": {
+ "type": "object",
+ "additionalProperties": { "type": "string" }
+ }
+ },
+ "required": [ "valid", "evaluationPath", "schemaLocation", "instanceLocation" ],
+ "allOf": [
+ {
+ "if": {
+ "anyOf": [
+ {
+ "required": [ "errors" ]
+ },
+ {
+ "required": [ "droppedAnnotations" ]
+ }
+ ]
+ },
+ "then": {
+ "properties": {
+ "valid": { "const": false }
+ }
+ }
+ },
+ {
+ "if": {
+ "required": [ "annotations" ]
+ },
+ "then": {
+ "properties": {
+ "valid": { "const": true }
+ }
+ }
+ }
+ ]
+ },
+ "outputUnitArray": {
+ "type": "array",
+ "items": { "$ref": "#/$defs/outputUnit" }
+ },
+ "flag": {
+ "properties": {
+ "valid": { "type": "boolean" }
+ },
+ "required": [ "valid" ]
+ },
+ "basic": {
+ "properties": {
+ "valid": { "type": "boolean" },
+ "details": {
+ "$ref": "#/$defs/outputUnitArray"
+ }
+ },
+ "required": [ "valid", "details" ]
+ },
+ "hierarchical": { "$ref": "#/$defs/outputUnit" }
+ }
+}
diff --git a/json/output-tests/draft2019-09/content/general.json b/json/output-tests/draft2019-09/content/general.json
new file mode 100644
index 0000000..9194170
--- /dev/null
+++ b/json/output-tests/draft2019-09/content/general.json
@@ -0,0 +1,34 @@
+[
+ {
+ "description": "failed validation produces no annotations",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "$id": "https://json-schema.org/tests/content/draft2019-09/general/0",
+ "type": "string",
+ "readOnly": true
+ },
+ "tests": [
+ {
+ "description": "readOnly annotation is dropped",
+ "data": 1,
+ "output": {
+ "basic": {
+ "$id": "https://json-schema.org/tests/content/draft2019-09/general/0/tests/0/basic",
+ "$ref": "/draft/2019-09/output/schema",
+ "properties": {
+ "errors": {
+ "items": {
+ "properties": {
+ "annotation": false
+ }
+ }
+ },
+ "annotations": false
+ },
+ "required": ["errors"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/output-tests/draft2019-09/content/readOnly.json b/json/output-tests/draft2019-09/content/readOnly.json
new file mode 100644
index 0000000..62db1a8
--- /dev/null
+++ b/json/output-tests/draft2019-09/content/readOnly.json
@@ -0,0 +1,38 @@
+[
+ {
+ "description": "readOnly generates its value as an annotation",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "$id": "https://json-schema.org/tests/content/draft2019-09/readOnly/0",
+ "readOnly": true
+ },
+ "tests": [
+ {
+ "description": "readOnly is true",
+ "data": 1,
+ "output": {
+ "basic": {
+ "$id": "https://json-schema.org/tests/content/draft2019-09/readOnly/0/tests/0/basic",
+ "$ref": "/draft/2019-09/output/schema",
+ "properties": {
+ "annotations": {
+ "contains": {
+ "type": "object",
+ "properties": {
+ "keywordLocation": {"const": "/readOnly"},
+ "absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2019-09/readOnly/0#/readOnly"},
+ "instanceLocation": {"const": ""},
+ "annotation": {"const": true}
+ },
+ "required": ["keywordLocation", "instanceLocation", "annotation"]
+ }
+ },
+ "errors": false
+ },
+ "required": ["annotations"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/output-tests/draft2019-09/content/type.json b/json/output-tests/draft2019-09/content/type.json
new file mode 100644
index 0000000..cff77a7
--- /dev/null
+++ b/json/output-tests/draft2019-09/content/type.json
@@ -0,0 +1,63 @@
+[
+ {
+ "description": "validating type",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "$id": "https://json-schema.org/tests/content/draft2019-09/type/0",
+ "type": "string",
+ "anyOf": [ true ]
+ },
+ "tests": [
+ {
+ "description": "incorrect type must be reported, but a message is not required",
+ "data": 1,
+ "output": {
+ "basic": {
+ "$id": "https://json-schema.org/tests/content/draft2019-09/type/0/tests/0/basic",
+ "$ref": "/draft/2019-09/output/schema",
+ "properties": {
+ "errors": {
+ "contains": {
+ "properties": {
+ "keywordLocation": {"const": "/type"},
+ "absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2019-09/type/0#/type"},
+ "instanceLocation": {"const": ""},
+ "annotation": false
+ },
+ "required": ["keywordLocation", "instanceLocation"]
+ }
+ }
+ },
+ "required": ["errors"]
+ }
+ }
+ },
+ {
+ "description": "correct type yields an output unit",
+ "data": "a string",
+ "output": {
+ "basic": {
+ "$id": "https://json-schema.org/tests/content/draft2019-09/type/0/tests/1/basic",
+ "$ref": "/draft/2019-09/output/schema",
+ "properties": {
+ "annotations": {
+ "contains": {
+ "properties": {
+ "valid": {"const": true},
+ "keywordLocation": {"const": "/type"},
+ "absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2019-09/type/0#/type"},
+ "instanceLocation": {"const": ""},
+ "annotation": false,
+ "error": false
+ },
+ "required": ["keywordLocation", "instanceLocation"]
+ }
+ }
+ },
+ "required": ["annotations"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/output-tests/draft2019-09/output-schema.json b/json/output-tests/draft2019-09/output-schema.json
new file mode 100644
index 0000000..0a65f20
--- /dev/null
+++ b/json/output-tests/draft2019-09/output-schema.json
@@ -0,0 +1,96 @@
+{
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "$id": "https://json-schema.org/draft/2019-09/output/schema",
+ "description": "A schema that validates the minimum requirements for validation output",
+
+ "anyOf": [
+ { "$ref": "#/$defs/flag" },
+ { "$ref": "#/$defs/basic" },
+ { "$ref": "#/$defs/detailed" },
+ { "$ref": "#/$defs/verbose" }
+ ],
+ "$defs": {
+ "outputUnit":{
+ "properties": {
+ "valid": { "type": "boolean" },
+ "keywordLocation": {
+ "type": "string",
+ "format": "json-pointer"
+ },
+ "absoluteKeywordLocation": {
+ "type": "string",
+ "format": "uri"
+ },
+ "instanceLocation": {
+ "type": "string",
+ "format": "json-pointer"
+ },
+ "error": {
+ "type": "string"
+ },
+ "errors": {
+ "$ref": "#/$defs/outputUnitArray"
+ },
+ "annotations": {
+ "$ref": "#/$defs/outputUnitArray"
+ }
+ },
+ "required": [ "valid", "keywordLocation", "instanceLocation" ],
+ "allOf": [
+ {
+ "if": {
+ "properties": {
+ "valid": { "const": false }
+ }
+ },
+ "then": {
+ "anyOf": [
+ {
+ "required": [ "error" ]
+ },
+ {
+ "required": [ "errors" ]
+ }
+ ]
+ }
+ },
+ {
+ "if": {
+ "anyOf": [
+ {
+ "properties": {
+ "keywordLocation": {
+ "pattern": "/\\$ref/"
+ }
+ }
+ },
+ {
+ "properties": {
+ "keywordLocation": {
+ "pattern": "/\\$dynamicRef/"
+ }
+ }
+ }
+ ]
+ },
+ "then": {
+ "required": [ "absoluteKeywordLocation" ]
+ }
+ }
+ ]
+ },
+ "outputUnitArray": {
+ "type": "array",
+ "items": { "$ref": "#/$defs/outputUnit" }
+ },
+ "flag": {
+ "properties": {
+ "valid": { "type": "boolean" }
+ },
+ "required": [ "valid" ]
+ },
+ "basic": { "$ref": "#/$defs/outputUnit" },
+ "detailed": { "$ref": "#/$defs/outputUnit" },
+ "verbose": { "$ref": "#/$defs/outputUnit" }
+ }
+}
diff --git a/json/output-tests/draft2020-12/content/general.json b/json/output-tests/draft2020-12/content/general.json
new file mode 100644
index 0000000..1f2b370
--- /dev/null
+++ b/json/output-tests/draft2020-12/content/general.json
@@ -0,0 +1,34 @@
+[
+ {
+ "description": "failed validation produces no annotations",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://json-schema.org/tests/content/draft2020-12/general/0",
+ "type": "string",
+ "readOnly": true
+ },
+ "tests": [
+ {
+ "description": "readOnly annotation is dropped",
+ "data": 1,
+ "output": {
+ "basic": {
+ "$id": "https://json-schema.org/tests/content/draft2020-12/general/0/tests/0/basic",
+ "$ref": "/draft/2020-12/output/schema",
+ "properties": {
+ "errors": {
+ "items": {
+ "properties": {
+ "annotation": false
+ }
+ }
+ },
+ "annotations": false
+ },
+ "required": ["errors"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/output-tests/draft2020-12/content/readOnly.json b/json/output-tests/draft2020-12/content/readOnly.json
new file mode 100644
index 0000000..9baf48d
--- /dev/null
+++ b/json/output-tests/draft2020-12/content/readOnly.json
@@ -0,0 +1,37 @@
+[
+ {
+ "description": "readOnly generates its value as an annotation",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://json-schema.org/tests/content/draft2020-12/readOnly/0",
+ "readOnly": true
+ },
+ "tests": [
+ {
+ "description": "readOnly is true",
+ "data": 1,
+ "output": {
+ "basic": {
+ "$id": "https://json-schema.org/tests/content/draft2020-12/readOnly/0/tests/0/basic",
+ "$ref": "/draft/2020-12/output/schema",
+ "properties": {
+ "annotations": {
+ "contains": {
+ "properties": {
+ "keywordLocation": {"const": "/readOnly"},
+ "absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2020-12/readOnly/0#/readOnly"},
+ "instanceLocation": {"const": ""},
+ "annotation": {"const": true}
+ },
+ "required": ["keywordLocation", "instanceLocation", "annotation"]
+ }
+ },
+ "errors": false
+ },
+ "required": ["annotations"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/output-tests/draft2020-12/content/type.json b/json/output-tests/draft2020-12/content/type.json
new file mode 100644
index 0000000..710475b
--- /dev/null
+++ b/json/output-tests/draft2020-12/content/type.json
@@ -0,0 +1,63 @@
+[
+ {
+ "description": "validating type",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://json-schema.org/tests/content/draft2020-12/type/0",
+ "type": "string",
+ "anyOf": [ true ]
+ },
+ "tests": [
+ {
+ "description": "incorrect type must be reported, but a message is not required",
+ "data": 1,
+ "output": {
+ "basic": {
+ "$id": "https://json-schema.org/tests/content/draft2020-12/type/0/tests/0/basic",
+ "$ref": "/draft/2020-12/output/schema",
+ "properties": {
+ "errors": {
+ "contains": {
+ "properties": {
+ "keywordLocation": {"const": "/type"},
+ "absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2020-12/type/0#/type"},
+ "instanceLocation": {"const": ""},
+ "annotation": false
+ },
+ "required": ["keywordLocation", "instanceLocation"]
+ }
+ }
+ },
+ "required": ["errors"]
+ }
+ }
+ },
+ {
+ "description": "correct type yields an output unit",
+ "data": "a string",
+ "output": {
+ "basic": {
+ "$id": "https://json-schema.org/tests/content/draft2020-12/type/0/tests/1/basic",
+ "$ref": "/draft/2020-12/output/schema",
+ "properties": {
+ "annotations": {
+ "contains": {
+ "properties": {
+ "valid": {"const": true},
+ "keywordLocation": {"const": "/type"},
+ "absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2020-12/type/0#/type"},
+ "instanceLocation": {"const": ""},
+ "annotation": false,
+ "error": false
+ },
+ "required": ["keywordLocation", "instanceLocation"]
+ }
+ }
+ },
+ "required": ["annotations"]
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/json/output-tests/draft2020-12/output-schema.json b/json/output-tests/draft2020-12/output-schema.json
new file mode 100644
index 0000000..1eef288
--- /dev/null
+++ b/json/output-tests/draft2020-12/output-schema.json
@@ -0,0 +1,96 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://json-schema.org/draft/2020-12/output/schema",
+ "description": "A schema that validates the minimum requirements for validation output",
+
+ "anyOf": [
+ { "$ref": "#/$defs/flag" },
+ { "$ref": "#/$defs/basic" },
+ { "$ref": "#/$defs/detailed" },
+ { "$ref": "#/$defs/verbose" }
+ ],
+ "$defs": {
+ "outputUnit":{
+ "properties": {
+ "valid": { "type": "boolean" },
+ "keywordLocation": {
+ "type": "string",
+ "format": "json-pointer"
+ },
+ "absoluteKeywordLocation": {
+ "type": "string",
+ "format": "uri"
+ },
+ "instanceLocation": {
+ "type": "string",
+ "format": "json-pointer"
+ },
+ "error": {
+ "type": "string"
+ },
+ "errors": {
+ "$ref": "#/$defs/outputUnitArray"
+ },
+ "annotations": {
+ "$ref": "#/$defs/outputUnitArray"
+ }
+ },
+ "required": [ "valid", "keywordLocation", "instanceLocation" ],
+ "allOf": [
+ {
+ "if": {
+ "properties": {
+ "valid": { "const": false }
+ }
+ },
+ "then": {
+ "anyOf": [
+ {
+ "required": [ "error" ]
+ },
+ {
+ "required": [ "errors" ]
+ }
+ ]
+ }
+ },
+ {
+ "if": {
+ "anyOf": [
+ {
+ "properties": {
+ "keywordLocation": {
+ "pattern": "/\\$ref/"
+ }
+ }
+ },
+ {
+ "properties": {
+ "keywordLocation": {
+ "pattern": "/\\$dynamicRef/"
+ }
+ }
+ }
+ ]
+ },
+ "then": {
+ "required": [ "absoluteKeywordLocation" ]
+ }
+ }
+ ]
+ },
+ "outputUnitArray": {
+ "type": "array",
+ "items": { "$ref": "#/$defs/outputUnit" }
+ },
+ "flag": {
+ "properties": {
+ "valid": { "type": "boolean" }
+ },
+ "required": [ "valid" ]
+ },
+ "basic": { "$ref": "#/$defs/outputUnit" },
+ "detailed": { "$ref": "#/$defs/outputUnit" },
+ "verbose": { "$ref": "#/$defs/outputUnit" }
+ }
+}