Skip to content

Commit

Permalink
test when $dynamicRef references a boolean schema
Browse files Browse the repository at this point in the history
  • Loading branch information
karenetheridge committed Nov 26, 2023
1 parent 95fe6ca commit dd27751
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/draft-next/dynamicRef.json
Original file line number Diff line number Diff line change
Expand Up @@ -612,5 +612,35 @@
"valid": false
}
]
},
{
"description": "$dynamicRef points to a boolean schema",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"true": true,
"false": false
},
"properties": {
"true": {
"$dynamicRef": "#/$defs/true"
},
"false": {
"$dynamicRef": "#/$defs/false"
}
}
},
"tests": [
{
"description": "follow $dynamicRef to a true schema",
"data": { "true": 1 },
"valid": true
},
{
"description": "follow $dynamicRef to a false schema",
"data": { "false": 1 },
"valid": false
}
]
}
]
30 changes: 30 additions & 0 deletions tests/draft2020-12/dynamicRef.json
Original file line number Diff line number Diff line change
Expand Up @@ -726,5 +726,35 @@
"valid": false
}
]
},
{
"description": "$dynamicRef points to a boolean schema",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"true": true,
"false": false
},
"properties": {
"true": {
"$dynamicRef": "#/$defs/true"
},
"false": {
"$dynamicRef": "#/$defs/false"
}
}
},
"tests": [
{
"description": "follow $dynamicRef to a true schema",
"data": { "true": 1 },
"valid": true
},
{
"description": "follow $dynamicRef to a false schema",
"data": { "false": 1 },
"valid": false
}
]
}
]

0 comments on commit dd27751

Please sign in to comment.