Skip to content

Commit 4922204

Browse files
committed
Add unevaluted with dynamic ref tests to draft-next
1 parent 8ba1c90 commit 4922204

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

tests/draft-next/unevaluatedItems.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,48 @@
461461
}
462462
]
463463
},
464+
{
465+
"description": "unevaluatedItems with $dynamicRef",
466+
"schema": {
467+
"$schema": "https://json-schema.org/draft/next/schema",
468+
"$id": "https://example.com/derived",
469+
470+
"$ref": "/baseSchema",
471+
472+
"$defs": {
473+
"derived": {
474+
"$dynamicAnchor": "addons",
475+
"prefixItems": [
476+
true,
477+
{ "type": "string" }
478+
]
479+
},
480+
"baseSchema": {
481+
"$id": "/baseSchema",
482+
483+
"$comment": "unevaluatedItems comes first so it's more likely to catch bugs with implementations that are sensitive to keyword ordering",
484+
"unevaluatedItems": false,
485+
"type": "array",
486+
"prefixItems": [
487+
{ "type": "string" }
488+
],
489+
"$dynamicRef": "#addons"
490+
}
491+
}
492+
},
493+
"tests": [
494+
{
495+
"description": "with no unevaluated items",
496+
"data": ["foo", "bar"],
497+
"valid": true
498+
},
499+
{
500+
"description": "with unevaluated items",
501+
"data": ["foo", "bar", "baz"],
502+
"valid": false
503+
}
504+
]
505+
},
464506
{
465507
"description": "unevaluatedItems can't see inside cousins",
466508
"schema": {

tests/draft-next/unevaluatedProperties.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,34 @@
715715
}
716716
]
717717
},
718+
{
719+
"description": "unevaluatedProperties with $dynamicRef",
720+
"schema": {
721+
"$schema": "https://json-schema.org/draft/next/schema",
722+
"$id": "https://example.com/derived",
723+
724+
"$ref": "/baseSchema",
725+
726+
"$defs": {
727+
"derived": {
728+
"$dynamicAnchor": "addons",
729+
"properties": {
730+
"bar": { "type": "string" }
731+
}
732+
},
733+
"baseSchema": {
734+
"$id": "/baseSchema",
735+
736+
"$comment": "unevaluatedProperties comes first so it's more likely to catch bugs with implementations that are sensitive to keyword ordering",
737+
"unevaluatedProperties": false,
738+
"type": "object",
739+
"properties": {
740+
"foo": { "type": "string" }
741+
},
742+
"$dynamicRef": "#addons"
743+
}
744+
}
745+
},
718746
{
719747
"description": "unevaluatedProperties can't see inside cousins",
720748
"schema": {

0 commit comments

Comments
 (0)