Skip to content

Commit

Permalink
Squashed 'json/' changes from a9a1e2e..95fe6ca
Browse files Browse the repository at this point in the history
95fe6ca Merge pull request #694 from json-schema-org/heterogeneous-additionalItems
9c88a0b Merge pull request #697 from json-schema-org/gregsdennis/add-ref-into-known-nonapplicator
fea2cf1 add tests for 2019 and 2020
6695ca3 add optional tests for `$ref`ing into known non-applicator keywords
cda4281 Merge pull request #695 from json-schema-org/ether/clean-up-subSchemas
7b9f45c move subSchemas-defs.json to subSchemas.json
e41ec0e remove unused definition files
349c5a8 Merge pull request #692 from json-schema-org/ether/fix-subSchemas-refs
451baca Merge pull request #670 from marksparkza/invalid-output-test
b8da838 Add tests for heterogeneous arrays with additionalItems
6d7a44b fix subschema locations and their $refs
ea0b63c Remove invalid output tests

git-subtree-dir: json
git-subtree-split: 95fe6ca20a90a019f4538f3670b6dd49d91dfdee
  • Loading branch information
Julian committed Oct 30, 2023
1 parent 628a2c9 commit 75f09dc
Show file tree
Hide file tree
Showing 27 changed files with 247 additions and 129 deletions.
26 changes: 0 additions & 26 deletions output-tests/draft2019-09/content/type.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,6 @@
"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"]
}
}
}
]
}
Expand Down
26 changes: 0 additions & 26 deletions output-tests/draft2020-12/content/type.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,6 @@
"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"]
}
}
}
]
}
Expand Down
11 changes: 0 additions & 11 deletions remotes/draft-next/subSchemas-defs.json

This file was deleted.

12 changes: 7 additions & 5 deletions remotes/draft-next/subSchemas.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"$schema": "https://json-schema.org/draft/next/schema",
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/integer"
"$defs": {
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/$defs/integer"
}
}
}
11 changes: 0 additions & 11 deletions remotes/draft2019-09/subSchemas-defs.json

This file was deleted.

12 changes: 7 additions & 5 deletions remotes/draft2019-09/subSchemas.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/integer"
"$defs": {
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/$defs/integer"
}
}
}
11 changes: 0 additions & 11 deletions remotes/draft2020-12/subSchemas-defs.json

This file was deleted.

12 changes: 7 additions & 5 deletions remotes/draft2020-12/subSchemas.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/integer"
"$defs": {
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/$defs/integer"
}
}
}
10 changes: 0 additions & 10 deletions remotes/subSchemas-defs.json

This file was deleted.

12 changes: 7 additions & 5 deletions remotes/subSchemas.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/integer"
"definitions": {
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/definitions/integer"
}
}
}
20 changes: 20 additions & 0 deletions tests/draft-next/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,26 @@
}
]
},
{
"description": "items with heterogeneous array",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"prefixItems": [{}],
"items": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "items with null instance elements",
"schema": {
Expand Down
23 changes: 23 additions & 0 deletions tests/draft-next/optional/refOfUnknownKeyword.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,28 @@
"valid": false
}
]
},
{
"description": "reference internals of known non-applicator",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$id": "/base",
"examples": [
{ "type": "string" }
],
"$ref": "#/examples/0"
},
"tests": [
{
"description": "match",
"data": "a string",
"valid": true
},
{
"description": "mismatch",
"data": 42,
"valid": false
}
]
}
]
4 changes: 2 additions & 2 deletions tests/draft-next/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"description": "fragment within remote ref",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$ref": "http://localhost:1234/draft-next/subSchemas-defs.json#/$defs/integer"
"$ref": "http://localhost:1234/draft-next/subSchemas.json#/$defs/integer"
},
"tests": [
{
Expand Down Expand Up @@ -60,7 +60,7 @@
"description": "ref within remote ref",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$ref": "http://localhost:1234/draft-next/subSchemas-defs.json#/$defs/refToInteger"
"$ref": "http://localhost:1234/draft-next/subSchemas.json#/$defs/refToInteger"
},
"tests": [
{
Expand Down
20 changes: 20 additions & 0 deletions tests/draft2019-09/additionalItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,26 @@
}
]
},
{
"description": "additionalItems with heterogeneous array",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"items": [{}],
"additionalItems": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "additionalItems with null instance elements",
"schema": {
Expand Down
23 changes: 23 additions & 0 deletions tests/draft2019-09/optional/refOfUnknownKeyword.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,28 @@
"valid": false
}
]
},
{
"description": "reference internals of known non-applicator",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "/base",
"examples": [
{ "type": "string" }
],
"$ref": "#/examples/0"
},
"tests": [
{
"description": "match",
"data": "a string",
"valid": true
},
{
"description": "mismatch",
"data": 42,
"valid": false
}
]
}
]
4 changes: 2 additions & 2 deletions tests/draft2019-09/refRemote.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"description": "fragment within remote ref",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$ref": "http://localhost:1234/draft2019-09/subSchemas-defs.json#/$defs/integer"
"$ref": "http://localhost:1234/draft2019-09/subSchemas.json#/$defs/integer"
},
"tests": [
{
Expand Down Expand Up @@ -60,7 +60,7 @@
"description": "ref within remote ref",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$ref": "http://localhost:1234/draft2019-09/subSchemas-defs.json#/$defs/refToInteger"
"$ref": "http://localhost:1234/draft2019-09/subSchemas.json#/$defs/refToInteger"
},
"tests": [
{
Expand Down
20 changes: 20 additions & 0 deletions tests/draft2020-12/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,26 @@
}
]
},
{
"description": "items with heterogeneous array",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [{}],
"items": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "items with null instance elements",
"schema": {
Expand Down
23 changes: 23 additions & 0 deletions tests/draft2020-12/optional/refOfUnknownKeyword.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,28 @@
"valid": false
}
]
},
{
"description": "reference internals of known non-applicator",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "/base",
"examples": [
{ "type": "string" }
],
"$ref": "#/examples/0"
},
"tests": [
{
"description": "match",
"data": "a string",
"valid": true
},
{
"description": "mismatch",
"data": 42,
"valid": false
}
]
}
]
Loading

0 comments on commit 75f09dc

Please sign in to comment.