Skip to content

Commit 2f50e78

Browse files
committed
add tests for $dynamicAnchor in multiple branches of propertyDependencies
1 parent 716b95d commit 2f50e78

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

tests/draft2020-12/dynamicRef.json

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,5 +631,86 @@
631631
"valid": true
632632
}
633633
]
634+
},
635+
{
636+
"description": "$dynamicAnchor inside propertyDependencies",
637+
"schema": {
638+
"$schema": "https://json-schema.org/draft/2020-12/schema",
639+
"$id": "http://localhost:1234/draft2020-12/dynamicanchor-in-propertydependencies.json",
640+
"$defs": {
641+
"inner": {
642+
"$id": "inner",
643+
"$dynamicAnchor": "foo",
644+
"type": "object",
645+
"additionalProperties": {
646+
"$dynamicRef": "#foo"
647+
}
648+
}
649+
},
650+
"propertyDependencies": {
651+
"expectedTypes": {
652+
"strings": {
653+
"$id": "east",
654+
"$dynamicAnchor": "foo",
655+
"type": "string",
656+
"$ref": "inner"
657+
},
658+
"integers": {
659+
"$id": "west",
660+
"$dynamicAnchor": "foo",
661+
"type": "integer",
662+
"$ref": "inner"
663+
}
664+
}
665+
}
666+
},
667+
"tests": [
668+
{
669+
"description": "expected strings - additional property as string is valid",
670+
"data": {
671+
"expectedTypes": "strings",
672+
"anotherProperty": "also a string"
673+
},
674+
"valid": true
675+
},
676+
{
677+
"description": "expected strings - additional property as not string is invalid",
678+
"data": {
679+
"expectedTypes": "strings",
680+
"anotherProperty": 42
681+
},
682+
"valid": false
683+
},
684+
{
685+
"description": "expected integers - additional property as integer is valid",
686+
"data": {
687+
"expectedTypes": "integers",
688+
"anotherProperty": 42
689+
},
690+
"valid": true
691+
},
692+
{
693+
"description": "expected integers - additional property as not integer is invalid",
694+
"data": {
695+
"expectedTypes": "integers",
696+
"anotherProperty": "a string"
697+
},
698+
"valid": false
699+
},
700+
{
701+
"description": "expected missing - additional property as an object is valid",
702+
"data": {
703+
"anotherProperty": {}
704+
},
705+
"valid": true
706+
},
707+
{
708+
"description": "expected missing - additional property as not object is invalid",
709+
"data": {
710+
"anotherProperty": 42
711+
},
712+
"valid": false
713+
}
714+
]
634715
}
635716
]

0 commit comments

Comments
 (0)