Unexpected behaviour with Retool JSON Schema Form component using oneOf object schemas. Form data is appended to and not replaced.
Minimum example required to recreate:
Using the following schema:
{
"title": "A registration form",
"description": "A simple form example.",
"type": "object",
"properties": {
"field": {
"oneOf": [
{
"title": "Lorem",
"properties": {
"lorem": {
"type": "object",
"properties": {
"lorem": {
"type": "string"
}
}
}
},
"required": [
"lorem"
]
},
{
"title": "Ipsum",
"properties": {
"ipsum": {
"type": "object",
"properties": {
"ipsum": {
"type": "string"
}
}
}
},
"required": [
"ipsum"
]
}
]
}
}
}
Gives the following in the react json schema form playground
Selecting the ipsum
option from the drop down replaces the object in the formData
This is expected behaviour.
Retool JSON Schema Form Component
Using the above schema yields the following component:
Form data is appended to and not replaced.
Form is therefore invalid because of the extra object key in the form data, which should be fully replaced.