Skip to content

Commit

Permalink
Squashed 'json/' changes from 54440eab4..ba3a90534
Browse files Browse the repository at this point in the history
ba3a90534 Merge pull request #523 from olegshtch/extendible-schema-test-suite
458e7ac1e Add test suite to test dynamic reference and anchor link and their independency of order
fe405a119 draft/future -> draft/next in $refs also
3d9d35a2a Merge pull request #522 from json-schema-org/ether/draft-next
11b5076f0 rename draft-future to draft-next
0245dcc94 Merge pull request #521 from olegshtch/add-recursive-ref-test-suite
e9fb9cf45 Merge pull request #517 from ChALkeR/chalker/date-time-leap
f1b230c69 Add test from Appendix C.  Example of recursive schema extension of the draft.
bb2e37317 Test date-time with leap second on a wrong hour/minute
8b797cfe6 Merge pull request #520 from json-schema-org/ether/custom-dialect
5d23f3112 Add tests for invalid date-time past leap second
63f8e93c1 Improve leap seconds test in optional/format/date-time
3d00f593d test the use of the $vocabulary keyword in a custom metaschema

git-subtree-dir: json
git-subtree-split: ba3a9053400dd6237aef9cc63601758b1d266818
  • Loading branch information
Julian committed Oct 19, 2021
1 parent cf88638 commit 4ecbea5
Show file tree
Hide file tree
Showing 85 changed files with 680 additions and 22 deletions.
11 changes: 11 additions & 0 deletions remotes/draft2019-09/metaschema-no-validation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$id": "http://localhost:1234/draft2019-09/metaschema-no-validation.json",
"$vocabulary": {
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
"https://json-schema.org/draft/2019-09/vocab/core": true
},
"allOf": [
{ "$ref": "https://json-schema.org/draft/2019-09/meta/applicator" },
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }
]
}
11 changes: 11 additions & 0 deletions remotes/draft2020-12/metaschema-no-validation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$id": "http://localhost:1234/draft2020-12/metaschema-no-validation.json",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/core": true
},
"allOf": [
{ "$ref": "https://json-schema.org/draft/2020-12/meta/applicator" },
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }
]
}
20 changes: 20 additions & 0 deletions remotes/extendible-dynamic-ref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"description": "extendible array",
"$id": "http://localhost:1234/extendible-dynamic-ref.json",
"type": "object",
"properties": {
"elements": {
"type": "array",
"items": {
"$dynamicRef": "#elements"
}
}
},
"required": ["elements"],
"additionalProperties": false,
"$defs": {
"elements": {
"$dynamicAnchor": "elements"
}
}
}
16 changes: 16 additions & 0 deletions remotes/tree.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"description": "tree schema, extensible",
"$id": "http://localhost:1234/tree.json",
"$dynamicAnchor": "node",

"type": "object",
"properties": {
"data": true,
"children": {
"type": "array",
"items": {
"$dynamicRef": "#node"
}
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -441,5 +441,179 @@
"valid": true
}
]
},
{
"description": "strict-tree schema, guards against misspelled properties",
"schema": {
"$id": "http://localhost:1234/strict-tree.json",
"$dynamicAnchor": "node",

"$ref": "tree.json",
"unevaluatedProperties": false
},
"tests": [
{
"description": "instance with misspelled field",
"data": {
"children": [{
"daat": 1
}]
},
"valid": false
},
{
"description": "instance with correct field",
"data": {
"children": [{
"data": 1
}]
},
"valid": true
}
]
},
{
"description": "tests for implementation dynamic anchor and reference link",
"schema": {
"$id": "http://localhost:1234/strict-extendible.json",
"$ref": "extendible-dynamic-ref.json",
"$defs": {
"elements": {
"$dynamicAnchor": "elements",
"properties": {
"a": true
},
"required": ["a"],
"additionalProperties": false
}
}
},
"tests": [
{
"description": "incorrect parent schema",
"data": {
"a": true
},
"valid": false
},
{
"description": "incorrect extended schema",
"data": {
"elements": [
{ "b": 1 }
]
},
"valid": false
},
{
"description": "correct extended schema",
"data": {
"elements": [
{ "a": 1 }
]
},
"valid": true
}
]
},
{
"description": "Tests for implementation dynamic anchor and reference link. Reference should be independent of any possible ordering.",
"schema": {
"$id": "http://localhost:1234/strict-extendible-allof-defs-first.json",
"allOf": [
{
"$ref": "extendible-dynamic-ref.json"
},
{
"$defs": {
"elements": {
"$dynamicAnchor": "elements",
"properties": {
"a": true
},
"required": ["a"],
"additionalProperties": false
}
}
}
]
},
"tests": [
{
"description": "incorrect parent schema",
"data": {
"a": true
},
"valid": false
},
{
"description": "incorrect extended schema",
"data": {
"elements": [
{ "b": 1 }
]
},
"valid": false
},
{
"description": "correct extended schema",
"data": {
"elements": [
{ "a": 1 }
]
},
"valid": true
}
]
},
{
"description": "Tests for implementation dynamic anchor and reference link. Reference should be independent of any possible ordering.",
"schema": {
"$id": "http://localhost:1234/strict-extendible-allof-ref-first.json",
"allOf": [
{
"$defs": {
"elements": {
"$dynamicAnchor": "elements",
"properties": {
"a": true
},
"required": ["a"],
"additionalProperties": false
}
}
},
{
"$ref": "extendible-dynamic-ref.json"
}
]
},
"tests": [
{
"description": "incorrect parent schema",
"data": {
"a": true
},
"valid": false
},
{
"description": "incorrect extended schema",
"data": {
"elements": [
{ "b": 1 }
]
},
"valid": false
},
{
"description": "correct extended schema",
"data": {
"elements": [
{ "a": 1 }
]
},
"valid": true
}
]
}
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/draft-future/id.json → tests/draft-next/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"description": "Invalid use of fragments in location-independent $id",
"schema": {
"$ref": "https://json-schema.org/draft/future/schema"
"$ref": "https://json-schema.org/draft/next/schema"
},
"tests": [
{
Expand Down Expand Up @@ -110,7 +110,7 @@
"description": "Valid use of empty fragments in location-independent $id",
"comment": "These are allowed but discouraged",
"schema": {
"$ref": "https://json-schema.org/draft/future/schema"
"$ref": "https://json-schema.org/draft/next/schema"
},
"tests": [
{
Expand Down Expand Up @@ -150,7 +150,7 @@
{
"description": "Unnormalized $ids are allowed but discouraged",
"schema": {
"$ref": "https://json-schema.org/draft/future/schema"
"$ref": "https://json-schema.org/draft/next/schema"
},
"tests": [
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,38 @@
"valid": true
},
{
"description": "a invalid day in date-time string",
"data": "1990-02-31T15:59:60.123-08:00",
"description": "a valid date-time with a leap second, UTC",
"data": "1998-12-31T23:59:60Z",
"valid": true
},
{
"description": "a valid date-time with a leap second, with minus offset",
"data": "1998-12-31T15:59:60.123-08:00",
"valid": true
},
{
"description": "an invalid date-time past leap second, UTC",
"data": "1998-12-31T23:59:61Z",
"valid": false
},
{
"description": "an invalid date-time with leap second on a wrong minute, UTC",
"data": "1998-12-31T23:58:60Z",
"valid": false
},
{
"description": "an invalid date-time with leap second on a wrong hour, UTC",
"data": "1998-12-31T22:59:60Z",
"valid": false
},
{
"description": "an invalid day in date-time string",
"data": "1990-02-31T15:59:59.123-08:00",
"valid": false
},
{
"description": "an invalid offset in date-time string",
"data": "1990-12-31T15:59:60-24:00",
"data": "1990-12-31T15:59:59-24:00",
"valid": false
},
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/draft-future/ref.json → tests/draft-next/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
{
"description": "remote ref, containing refs itself",
"schema": {
"$ref": "https://json-schema.org/draft/future/schema"
"$ref": "https://json-schema.org/draft/next/schema"
},
"tests": [
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions tests/draft-next/vocabulary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"description": "schema that uses custom metaschema with with no validation vocabulary",
"schema": {
"$id": "https://schema/using/no/validation",
"$schema": "http://localhost:1234/draft2020-12/metaschema-no-validation.json",
"properties": {
"badProperty": false,
"numberProperty": {
"minimum": 10
}
}
},
"tests": [
{
"description": "applicator vocabulary still works",
"data": {
"badProperty": "this property should not exist"
},
"valid": false
},
{
"description": "no validation: valid number",
"data": 20,
"valid": true
},
{
"description": "no validation: invalid number, but it still validates",
"data": 1,
"valid": true
}
]
}
]
31 changes: 28 additions & 3 deletions tests/draft2019-09/optional/format/date-time.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,38 @@
"valid": true
},
{
"description": "a invalid day in date-time string",
"data": "1990-02-31T15:59:60.123-08:00",
"description": "a valid date-time with a leap second, UTC",
"data": "1998-12-31T23:59:60Z",
"valid": true
},
{
"description": "a valid date-time with a leap second, with minus offset",
"data": "1998-12-31T15:59:60.123-08:00",
"valid": true
},
{
"description": "an invalid date-time past leap second, UTC",
"data": "1998-12-31T23:59:61Z",
"valid": false
},
{
"description": "an invalid date-time with leap second on a wrong minute, UTC",
"data": "1998-12-31T23:58:60Z",
"valid": false
},
{
"description": "an invalid date-time with leap second on a wrong hour, UTC",
"data": "1998-12-31T22:59:60Z",
"valid": false
},
{
"description": "an invalid day in date-time string",
"data": "1990-02-31T15:59:59.123-08:00",
"valid": false
},
{
"description": "an invalid offset in date-time string",
"data": "1990-12-31T15:59:60-24:00",
"data": "1990-12-31T15:59:59-24:00",
"valid": false
},
{
Expand Down
Loading

0 comments on commit 4ecbea5

Please sign in to comment.