Skip to content

Commit 589a085

Browse files
authored
Merge pull request #706 from marksparkza/unevaluated-before-ref
Test early placement of unevaluatedItems|Properties with $ref
2 parents 64d5cab + 4a2c61e commit 589a085

File tree

6 files changed

+207
-0
lines changed

6 files changed

+207
-0
lines changed

tests/draft-next/unevaluatedItems.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,37 @@
461461
}
462462
]
463463
},
464+
{
465+
"description": "unevaluatedItems before $ref",
466+
"schema": {
467+
"$schema": "https://json-schema.org/draft/next/schema",
468+
"unevaluatedItems": false,
469+
"prefixItems": [
470+
{ "type": "string" }
471+
],
472+
"$ref": "#/$defs/bar",
473+
"$defs": {
474+
"bar": {
475+
"prefixItems": [
476+
true,
477+
{ "type": "string" }
478+
]
479+
}
480+
}
481+
},
482+
"tests": [
483+
{
484+
"description": "with no unevaluated items",
485+
"data": ["foo", "bar"],
486+
"valid": true
487+
},
488+
{
489+
"description": "with unevaluated items",
490+
"data": ["foo", "bar", "baz"],
491+
"valid": false
492+
}
493+
]
494+
},
464495
{
465496
"description": "unevaluatedItems with $dynamicRef",
466497
"schema": {

tests/draft-next/unevaluatedProperties.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,44 @@
715715
}
716716
]
717717
},
718+
{
719+
"description": "unevaluatedProperties before $ref",
720+
"schema": {
721+
"$schema": "https://json-schema.org/draft/next/schema",
722+
"type": "object",
723+
"unevaluatedProperties": false,
724+
"properties": {
725+
"foo": { "type": "string" }
726+
},
727+
"$ref": "#/$defs/bar",
728+
"$defs": {
729+
"bar": {
730+
"properties": {
731+
"bar": { "type": "string" }
732+
}
733+
}
734+
}
735+
},
736+
"tests": [
737+
{
738+
"description": "with no unevaluated properties",
739+
"data": {
740+
"foo": "foo",
741+
"bar": "bar"
742+
},
743+
"valid": true
744+
},
745+
{
746+
"description": "with unevaluated properties",
747+
"data": {
748+
"foo": "foo",
749+
"bar": "bar",
750+
"baz": "baz"
751+
},
752+
"valid": false
753+
}
754+
]
755+
},
718756
{
719757
"description": "unevaluatedProperties with $dynamicRef",
720758
"schema": {

tests/draft2019-09/unevaluatedItems.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,37 @@
480480
}
481481
]
482482
},
483+
{
484+
"description": "unevaluatedItems before $ref",
485+
"schema": {
486+
"$schema": "https://json-schema.org/draft/2019-09/schema",
487+
"unevaluatedItems": false,
488+
"items": [
489+
{ "type": "string" }
490+
],
491+
"$ref": "#/$defs/bar",
492+
"$defs": {
493+
"bar": {
494+
"items": [
495+
true,
496+
{ "type": "string" }
497+
]
498+
}
499+
}
500+
},
501+
"tests": [
502+
{
503+
"description": "with no unevaluated items",
504+
"data": ["foo", "bar"],
505+
"valid": true
506+
},
507+
{
508+
"description": "with unevaluated items",
509+
"data": ["foo", "bar", "baz"],
510+
"valid": false
511+
}
512+
]
513+
},
483514
{
484515
"description": "unevaluatedItems with $recursiveRef",
485516
"schema": {

tests/draft2019-09/unevaluatedProperties.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,44 @@
715715
}
716716
]
717717
},
718+
{
719+
"description": "unevaluatedProperties before $ref",
720+
"schema": {
721+
"$schema": "https://json-schema.org/draft/2019-09/schema",
722+
"type": "object",
723+
"unevaluatedProperties": false,
724+
"properties": {
725+
"foo": { "type": "string" }
726+
},
727+
"$ref": "#/$defs/bar",
728+
"$defs": {
729+
"bar": {
730+
"properties": {
731+
"bar": { "type": "string" }
732+
}
733+
}
734+
}
735+
},
736+
"tests": [
737+
{
738+
"description": "with no unevaluated properties",
739+
"data": {
740+
"foo": "foo",
741+
"bar": "bar"
742+
},
743+
"valid": true
744+
},
745+
{
746+
"description": "with unevaluated properties",
747+
"data": {
748+
"foo": "foo",
749+
"bar": "bar",
750+
"baz": "baz"
751+
},
752+
"valid": false
753+
}
754+
]
755+
},
718756
{
719757
"description": "unevaluatedProperties with $recursiveRef",
720758
"schema": {

tests/draft2020-12/unevaluatedItems.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,37 @@
461461
}
462462
]
463463
},
464+
{
465+
"description": "unevaluatedItems before $ref",
466+
"schema": {
467+
"$schema": "https://json-schema.org/draft/2020-12/schema",
468+
"unevaluatedItems": false,
469+
"prefixItems": [
470+
{ "type": "string" }
471+
],
472+
"$ref": "#/$defs/bar",
473+
"$defs": {
474+
"bar": {
475+
"prefixItems": [
476+
true,
477+
{ "type": "string" }
478+
]
479+
}
480+
}
481+
},
482+
"tests": [
483+
{
484+
"description": "with no unevaluated items",
485+
"data": ["foo", "bar"],
486+
"valid": true
487+
},
488+
{
489+
"description": "with unevaluated items",
490+
"data": ["foo", "bar", "baz"],
491+
"valid": false
492+
}
493+
]
494+
},
464495
{
465496
"description": "unevaluatedItems with $dynamicRef",
466497
"schema": {

tests/draft2020-12/unevaluatedProperties.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,44 @@
715715
}
716716
]
717717
},
718+
{
719+
"description": "unevaluatedProperties before $ref",
720+
"schema": {
721+
"$schema": "https://json-schema.org/draft/2020-12/schema",
722+
"type": "object",
723+
"unevaluatedProperties": false,
724+
"properties": {
725+
"foo": { "type": "string" }
726+
},
727+
"$ref": "#/$defs/bar",
728+
"$defs": {
729+
"bar": {
730+
"properties": {
731+
"bar": { "type": "string" }
732+
}
733+
}
734+
}
735+
},
736+
"tests": [
737+
{
738+
"description": "with no unevaluated properties",
739+
"data": {
740+
"foo": "foo",
741+
"bar": "bar"
742+
},
743+
"valid": true
744+
},
745+
{
746+
"description": "with unevaluated properties",
747+
"data": {
748+
"foo": "foo",
749+
"bar": "bar",
750+
"baz": "baz"
751+
},
752+
"valid": false
753+
}
754+
]
755+
},
718756
{
719757
"description": "unevaluatedProperties with $dynamicRef",
720758
"schema": {

0 commit comments

Comments
 (0)