rjsf-team/react-jsonschema-form
View on GitHubNested `if` / `else` support is flaky when using `enums`
Open
#3618 opened on Apr 21, 2023
bughelp wantedif-then-else
Description
Prerequisites
- I have searched the existing issues
- I understand that providing a SSCCE example is tremendously useful to the maintainers.
- I have read the documentation
- Ideally, I'm providing a sample JSFiddle, Codesandbox.io or preferably a shared playground link demonstrating the issue.
What theme are you using?
core
Version
5.x
Current Behavior
With this schema:
{
"type": "object",
"properties": {
"type": {
"enum": [
"list-select",
"empty",
"static"
]
}
},
"if": {
"properties": {
"type": {
"const": "static"
}
}
},
"then": {
"properties": {
"value": {
"type": "string"
}
}
},
"else": {
"if": {
"properties": {
"type": {
"const": "list-select"
}
}
},
"then": {
"properties": {
"id": {
"enum": []
}
}
}
}
}
the value string field won't render. If you change the "enum": [] line to something else let's say: "type": "string" then it works.
Expected Behavior
I would have expected it to work either way, although if it didn't work in both cases that would be better than what it is now IMO
Steps To Reproduce
Select static on both examples and you will see that the value field gets rendered in one but not the other.
Environment
- OS: MacOS
- Browser: Arc
Anything else?
No response