jsonforms
jsonforms copied to clipboard
Missing oneOf renderer for angular material
Describe the bug
When adding items to interfaces No applicable renderer found! appears.
Expected behavior
Show dropdown to select object type among oneOf options and render a form
Steps to reproduce the issue
Use this schema to reproduce an issue:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Router Configuration (Strict Model)",
"type": "object",
"properties": {
"interfaces": {
"type": "array",
"title": "Interfaces",
"uniqueItems": true,
"items": {
"title": "Interface",
"oneOf": [
{
"$ref": "#/definitions/iface_ethernet"
},
{
"$ref": "#/definitions/iface_bond"
},
{
"$ref": "#/definitions/iface_vlan"
},
{
"$ref": "#/definitions/iface_bridge"
},
{
"$ref": "#/definitions/iface_loopback"
}
]
}
}
},
"definitions": {
"// --- 1. SYSTEM INTERFACES ---": {},
"iface_ethernet": {
"type": "object",
"title": "Physical Ethernet",
"required": [
"name",
"type"
],
"properties": {
"type": {
"type": "string",
"const": "ethernet",
"default": "ethernet",
"title": "Type",
"readOnly": true,
"ui:widget": "hidden"
},
"name": {
"$ref": "#/definitions/field_name"
},
"addresses": {
"$ref": "#/definitions/field_addresses"
},
"mtu": {
"$ref": "#/definitions/field_mtu"
},
"macaddress": {
"type": "string",
"title": "Override MAC",
"pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"
},
"description": {
"$ref": "#/definitions/field_desc"
}
}
},
"iface_bond": {
"type": "object",
"title": "Bond",
"required": [
"name",
"type",
"interfaces"
],
"properties": {
"type": {
"type": "string",
"const": "bond",
"default": "bond",
"title": "Type",
"readOnly": true,
"ui:widget": "hidden"
},
"name": {
"$ref": "#/definitions/field_name"
},
"interfaces": {
"type": "array",
"title": "Members",
"minItems": 1,
"items": {
"type": "string"
}
},
"parameters": {
"type": "object",
"title": "LACP Parameters",
"properties": {
"mode": {
"type": "string",
"enum": [
"802.3ad",
"active-backup",
"balance-xor"
],
"default": "802.3ad"
},
"lacp-rate": {
"type": "string",
"enum": [
"slow",
"fast"
],
"default": "fast"
},
"hash-policy": {
"type": "string",
"enum": [
"layer2",
"layer2+3",
"layer3+4"
],
"default": "layer3+4"
}
}
},
"addresses": {
"$ref": "#/definitions/field_addresses"
},
"mtu": {
"$ref": "#/definitions/field_mtu"
},
"description": {
"$ref": "#/definitions/field_desc"
}
}
},
"iface_vlan": {
"type": "object",
"title": "VLAN",
"required": [
"name",
"type",
"vlan_id",
"link"
],
"properties": {
"type": {
"type": "string",
"const": "vlan",
"default": "vlan",
"title": "Type",
"readOnly": true,
"ui:widget": "hidden"
},
"name": {
"$ref": "#/definitions/field_name"
},
"vlan_id": {
"type": "integer",
"minimum": 1,
"maximum": 4094,
"title": "VLAN ID"
},
"link": {
"type": "string",
"title": "Parent Interface"
},
"addresses": {
"$ref": "#/definitions/field_addresses"
},
"mtu": {
"$ref": "#/definitions/field_mtu"
},
"description": {
"$ref": "#/definitions/field_desc"
}
}
},
"iface_bridge": {
"type": "object",
"title": "Bridge",
"required": [
"name",
"type",
"interfaces"
],
"properties": {
"type": {
"type": "string",
"const": "bridge",
"default": "bridge",
"title": "Type",
"readOnly": true,
"ui:widget": "hidden"
},
"name": {
"$ref": "#/definitions/field_name"
},
"interfaces": {
"type": "array",
"title": "Bridge Ports",
"items": {
"type": "string"
}
},
"addresses": {
"$ref": "#/definitions/field_addresses"
},
"mtu": {
"$ref": "#/definitions/field_mtu"
},
"description": {
"$ref": "#/definitions/field_desc"
}
}
},
"iface_loopback": {
"type": "object",
"title": "Loopback",
"required": [
"name",
"type"
],
"properties": {
"type": {
"type": "string",
"const": "loopback",
"default": "loopback",
"title": "Type",
"readOnly": true,
"ui:widget": "hidden"
},
"name": {
"$ref": "#/definitions/field_name"
},
"addresses": {
"$ref": "#/definitions/field_addresses"
},
"description": {
"$ref": "#/definitions/field_desc"
}
}
},
"field_name": {
"type": "string",
"title": "Name",
"pattern": "^[a-zA-Z0-9_.-]+$"
},
"field_addresses": {
"type": "array",
"title": "IP Addresses",
"items": {
"type": "string",
"title": "CIDR",
"description": "e.g. 192.168.1.1/24"
}
},
"field_mtu": {
"type": "integer",
"title": "MTU",
"default": 1500,
"minimum": 68,
"maximum": 65535
},
"field_desc": {
"type": "string",
"title": "Description"
}
}
}
Screenshots
No response
Which Version of JSON Forms are you using?
v3.7.0
Package
Angular Material Renderers
Additional context
No response
Hi @menelai , thanks for the report ❤️. This happens because there currently is no oneOf renderer for the Angular Material renderer set. It is currently not a priority for us to add one ourselves but we would definitely consider and review a contribution.
For reference, there are oneOf renderers for the React Material renderers and the Vue vuetify renderers that might be used as a starting point.