rjsf-team/react-jsonschema-form
View on GitHubNested dependencies not updated correctly
Open
#3450 opened on Feb 21, 2023
any-one-all-ofbughelp wantedutils
Description
Prerequisites
- I have read the documentation
What theme are you using?
core
What is your question?
https://codesandbox.io/s/black-forest-bgkbeo?file=/src/App.js As example, conditinal schema property value not update as expected. when "animal" change to "Cat", "food" should be "meat".
schema.json
{
"type": "object",
"properties": {
"animal": {
"enum": ["Cat", "Fish"],
"default": "Cat"
}
},
"allOf": [
{
"if": {
"properties": {
"animal": {
"const": "Cat"
}
}
},
"then": {
"properties": {
"food": {
"type": "string",
"enum": ["meat", "grass", "fish"],
"default": "meat"
}
},
"required": ["food"]
}
},
{
"if": {
"properties": {
"animal": {
"const": "Fish"
}
}
},
"then": {
"properties": {
"food": {
"type": "string",
"enum": ["insect", "worms"],
"default": "insect"
},
"water": {
"type": "string",
"enum": ["lake", "sea"],
"default": "lake"
}
},
"required": ["food", "water"]
}
},
{
"required": ["animal"]
}
]
}