You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use the dropdown to switch between schemas option 1 or option 2 and fill in the form and submit I expect either this form data
{
"lorem": {
"f1": "aa",
"f2": "aa"
}
}
or this form data
{
"ipsum": {
"g1": "aa"
}
}
Actual behavior
however with the first option I always get the first schema only (lorem above) but with the second option I always get both with the first schema empty.
{
"lorem": {},
"ipsum": {
"g1": "aa"
}
}
I don't understand why.
Also as I use the dropdown to switch between the schemas I get this error "should match exactly one schema in oneOf", even though I can successfully complete the field and submit without error.
I just want to use the dropdown to pick between two objects with properties and fill in the fields and get form data for just one of them.
The only modification was to change the "lorem" type from "string" to "object". When switching to Option 2 ("ipsum"), the "lorem" property is not removed from the formData.
Prerequisites
Description
oneOf picks first schema or both in playground, not either or
Steps to Reproduce
Use this json schema in the playground:
{
"type": "object",
"oneOf": [
{
"properties": {
"lorem": {
"type": "object",
"properties": {
"f1": {
"type": "string"
},
"f2": {
"type": "string"
}
},
"required": ["f1", "f2"]
}
},
"required": [ "lorem"
]
},
{
"properties": {
"ipsum": {
"type": "object",
"properties": {
"g1": {
"type": "string"
}
},
"required": ["g1"]
}
},
"required": [ "ipsum"
]
}
]
}
Expected behavior
When I use the dropdown to switch between schemas option 1 or option 2 and fill in the form and submit I expect either this form data
{
"lorem": {
"f1": "aa",
"f2": "aa"
}
}
or this form data
{
"ipsum": {
"g1": "aa"
}
}
Actual behavior
however with the first option I always get the first schema only (lorem above) but with the second option I always get both with the first schema empty.
{
"lorem": {},
"ipsum": {
"g1": "aa"
}
}
I don't understand why.
Also as I use the dropdown to switch between the schemas I get this error "should match exactly one schema in oneOf", even though I can successfully complete the field and submit without error.
I just want to use the dropdown to pick between two objects with properties and fill in the fields and get form data for just one of them.
Version
Playground:
https://rjsf-team.github.io/react-jsonschema-form/
The text was updated successfully, but these errors were encountered: