react-jsonschema-form
react-jsonschema-form copied to clipboard
Homebridge compatibility
Prerequisites
- [X] I have read the documentation
What theme are you using?
validator-ajv8
What is your question?
I am attempting to render Homebridge plugins config schemas which work fine with AJSF but render differently with RJSF.
The config schema for the plugin is as follows:
{
"pluginAlias": "HomeConnect",
"pluginType": "platform",
"dynamicSchemaVersion": 1,
"singular": true,
"headerDisplay": "*This is a temporary configuration schema for initial setup only. When the plugin runs it will replace this schema with one tailored to the available Home Connect appliances.*\n\n*Update [homebridge-config-ui-x](https://github.com/oznu/homebridge-config-ui-x) to version 4.8.1 or later if this message remains after the Home Connect Client has been configured.*\n\nFor help please refer to the [README](https://github.com/thoukydides/homebridge-homeconnect/blob/master/README.md) and [`config.json`](https://github.com/thoukydides/homebridge-homeconnect/wiki/config.json).",
"footerDisplay": "© 2019-2021 [Alexander Thoukydides](https://www.thouky.co.uk/)",
"schema": {
"type": "object",
"properties": {
"clientid": {
"type": "string",
"minLength": 64,
"maxLength": 64,
"pattern": "^[0-9A-Fa-f]+$",
"required": true
},
"simulator": {
"type": "boolean",
"default": false,
"enumNames":["ba", "bo"],
"required": true
},
"language": {
"type": "object",
"properties": {
"api": {
"type": "string",
"default": "en-GB",
"oneOf": [
{
"title": "Bulgarian",
"const": "bg-BG"
},
{
"title": "Chinese (Simplified): China - Chinese (Simplified)",
"const": "zh-CN"
},
{
"title": "Chinese (Simplified): Hong Kong - Chinese (Simplified)",
"const": "zh-HK"
},
{
"title": "Chinese (Simplified): Taiwan, Province of China - Chinese (Simplified)",
"const": "zh-TW"
},
],
"required": true
}
}
}
}
},
"form": [
{
"type": "fieldset",
"title": "Home Connect Client",
"expandable": false,
"items": [
{
"key": "simulator",
"title": "Client Type",
"type": "select",
"titleMap": {
"false": "Physical Appliances (production server)",
"true": "Simulated Appliances (test server)"
}
},
{
"key": "clientid",
"title": "Client ID",
"description": "Create an application via the <a href=\"https://developer.home-connect.com/applications\">Home Connect Developer Program</a>, with <strong>OAuth Flow</strong> set to <strong>Device Flow</strong>.",
"placeholder": "e.g. 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
"condition": {
"functionBody": "return !model.simulator"
}
},
{
"key": "clientid",
"title": "Client ID",
"description": "Enter the Client ID for the automatically generated <a href=\"https://developer.home-connect.com/applications\">API Web Client</a> to use the <a href=\"https://developer.home-connect.com/simulator\">Appliance Simulators</a>.<br>Use this to test the functionality of this plugin without requiring access to physical appliances.",
"placeholder": "e.g. 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF",
"condition": {
"functionBody": "return model.simulator"
}
},
{
"key": "language.api",
"title": "API Language",
"description": "This changes the language used for program names and their options.",
"condition": {
"functionBody": "return !model.simulator && model.clientid"
}
},
{
"type": "help",
"helpvalue": "<p>This plugin requires authorisation to access Home Connect appliances.</p><p>The authorisation link will appear here (and in the Homebridge log file) after the Client ID has been configured and the plugin started.</p>",
"condition": {
"functionBody": "return !model.simulator && model.clientid"
}
}
]
}
],
"display": null
}
Which renders

My attempt to create the format appropriate for RJSF can be found in the contained link A can be seen the rendered value is fairly different than what the AJSF example rendered.
My questions are as follows:
-
Is any format which is supported in AJSF also supported is RJSF?
-
If the above question is yes, that is, any format supported in AJSF can also be replicated in RJSF then I have the following 2 questions:
- How do I replicate the conditional renders found in the above AJSF example "condition": { functionBody": "return !model.simulator && model.clientid" }
- How must we write
{ "key": "language.api", <------- "title": "API Language", "description": "This changes the language used for program names and their options.", "condition": { "functionBody": "return !model.simulator && model.clientid" } to match the proper format for RJSF
@TDDEL Give it a try and let us know what you find out. We definitely should support JSONSchema at the draft 7 version. If you are using newer drafts, it is possible that not everything is going to work as we don't recognize the newer keywords. AJSF seems to have crushed everything together and verged dramatically away from the approach RJSF took. You will likely have to separate your JSONSchema from the other non-JSONSchema elements and transform them in to UiSchema and formData. Good luck!
This issue has been automatically marked as possibly close because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.
This issue was closed because of lack of recent activity. Reopen if you still need assistance.