Skip to content

Commit 217bf81

Browse files
Merge pull request #701 from json-schema-org/ether/dynamicRef-boolean
test when $dynamicRef references a boolean schema
2 parents 7a3d06d + 4e9640c commit 217bf81

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

tests/draft-next/dynamicRef.json

+30
Original file line numberDiff line numberDiff line change
@@ -612,5 +612,35 @@
612612
"valid": false
613613
}
614614
]
615+
},
616+
{
617+
"description": "$dynamicRef points to a boolean schema",
618+
"schema": {
619+
"$schema": "https://json-schema.org/draft/next/schema",
620+
"$defs": {
621+
"true": true,
622+
"false": false
623+
},
624+
"properties": {
625+
"true": {
626+
"$dynamicRef": "#/$defs/true"
627+
},
628+
"false": {
629+
"$dynamicRef": "#/$defs/false"
630+
}
631+
}
632+
},
633+
"tests": [
634+
{
635+
"description": "follow $dynamicRef to a true schema",
636+
"data": { "true": 1 },
637+
"valid": true
638+
},
639+
{
640+
"description": "follow $dynamicRef to a false schema",
641+
"data": { "false": 1 },
642+
"valid": false
643+
}
644+
]
615645
}
616646
]

tests/draft2020-12/dynamicRef.json

+30
Original file line numberDiff line numberDiff line change
@@ -726,5 +726,35 @@
726726
"valid": false
727727
}
728728
]
729+
},
730+
{
731+
"description": "$dynamicRef points to a boolean schema",
732+
"schema": {
733+
"$schema": "https://json-schema.org/draft/2020-12/schema",
734+
"$defs": {
735+
"true": true,
736+
"false": false
737+
},
738+
"properties": {
739+
"true": {
740+
"$dynamicRef": "#/$defs/true"
741+
},
742+
"false": {
743+
"$dynamicRef": "#/$defs/false"
744+
}
745+
}
746+
},
747+
"tests": [
748+
{
749+
"description": "follow $dynamicRef to a true schema",
750+
"data": { "true": 1 },
751+
"valid": true
752+
},
753+
{
754+
"description": "follow $dynamicRef to a false schema",
755+
"data": { "false": 1 },
756+
"valid": false
757+
}
758+
]
729759
}
730760
]

0 commit comments

Comments
 (0)