Angular JSONForms oneOf with custom radio renderer: selected branch does not show any fields

I’m trying to use JSONForms with a custom radio renderer to handle a oneOf.
The idea is simple: select Natural person OR Legal person via radio buttons → only that branch’s fields should show up.

But when I select an option, no fields are rendered under the radio, even though the radio changes.

“type”: “object”,
“properties”: {
“affectedPerson”: {
“oneOf”: [
{
“title”: “Natural”,
“type”: “object”,
“properties”: {
“affectedPersonNatural”: {
“type”: “object”,
“properties”: {
“firstName”: { “type”: “string” },
“lastName”: { “type”: “string” }
}
}
},
“required”: [“affectedPersonNatural”]
},
{
“title”: “Legal”,
“type”: “object”,
“properties”: {
“affectedPersonLegal”: {
“type”: “object”,
“properties”: {
“companyName”: { “type”: “string” },
“legalForm”: { “type”: “string” }
}
}
},
“required”: [“affectedPersonLegal”]
}
]
}
}
}

UI Schema

{
“type”: “VerticalLayout”,
“elements”: [
{
“type”: “Control”,
“scope”: “#/properties/affectedPerson”,
“label”: “Affected Person”,
“options”: {
“detail”: {
“type”: “VerticalLayout”,
“elements”: [
{
“type”: “Group”,
“label”: “Natural person”,
“elements”: [
{
“type”: “Control”,
“scope”: “#/properties/affectedPersonNatural/properties/firstName”,
“label”: “First name”
},
{
“type”: “Control”,
“scope”: “#/properties/affectedPersonNatural/properties/lastName”,
“label”: “Last name”``}
]
},
{
“type”: “Group”,
“label”: “Legal person”,
“elements”: [`
{
“type”: “Control”,
“scope”: “#/properties/affectedPersonLegal/properties/companyName”,
“label”: “Company name”
},
{
“type”: “Control”,
“scope”: “#/properties/affectedPersonLegal/properties/legalForm”,
“label”: “Legal form”`
}
]
}
]
}
}
}
]
}

Hi @vsam ,

it seems that you have only one control pointing to #/properties/affectedPerson that is rendered by your custom renderer that then uses the ui schema given in the detail somehow?

While we don’t have a oneOf Angular renderer so far that you can look at, you could look at the react material oneof renderer as hints on how to render the child properties: jsonforms/packages/material-renderers/src/complex/MaterialOneOfRenderer.tsx at 016f1dff9653ac2e977564cbd6d850593309c551 · eclipsesource/jsonforms · GitHub

Best regards,

Lucas