I am trying to refer to nested elements of my schema using this JSON schema form component, see the attached file below for an example project in Retool.
JSON Schema Form IfElse test.json (8.8 KB)
I was able to use this JSON in the json-schema-form-playground
When I insert it into a Retool project I get this error:
The main goal I am trying to accomplish here is have one of the nested parameters drive logic for what the maximum values can be for other nested parameters.
Here is my JSON schema form:
{
"definitions": {
"field1": {
"type": "string",
"title": "Field One",
"enum": [
"Ten Max",
"Fifty Max",
"Thousand Max"
]
},
"field2": {
"type": "integer",
"title": "Field Two",
"minimum": 0
},
"field3": {
"type": "object",
"title": "Field Three",
"required": [
"field3dot1",
"field3dot2",
"field3dot3"
],
"properties": {
"field3dot1": {
"type": "string",
"title": "Field Three Dot One",
"enum": [
"Ten Max Things",
"Fifty Max Things",
"Thousand Max Things"
]
},
"field3dot2": {
"type": "integer",
"title": "Field Three Dot Two",
"minimum": 0
}
}
},
"field4": {
"type": "integer",
"title": "Field Four",
"minimum": 0
}
},
"title": "Help Me Retool!",
"description": "asdf",
"type": "object",
"required": [
"field1",
"field2",
"field3",
"field4"
],
"properties": {
"field1": {
"$ref": "#/definitions/field1"
},
"field2": {
"$ref": "#/definitions/field2"
},
"field3": {
"$ref": "#/definitions/field3"
},
"field4": {
"$ref": "#/definitions/field4"
}
},
"allOf": [
{
"if": {
"properties": {
"field1": {
"const": "Ten Max"
}
}
},
"then": {
"properties": {
"field2": {
"maximum": 10
}
}
}
},
{
"if": {
"properties": {
"field1": {
"const": "Fifty Max"
}
}
},
"then": {
"properties": {
"field2": {
"maximum": 50
}
}
}
},
{
"if": {
"properties": {
"field1": {
"const": "Thousand Max"
}
}
},
"then": {
"properties": {
"field2": {
"maximum": 1000
}
}
}
},
{
"if": {
"properties": {
"field3": {
"properties": {
"field3dot1": {
"const": "Ten Max Things"
}
}
}
}
},
"then": {
"properties": {
"field3": {
"properties": {
"field3dot2": {
"maximum": 10
}
}
},
"field4": {
"maximum": 10
}
}
}
},
{
"if": {
"properties": {
"field3": {
"properties": {
"field3dot1": {
"const": "Fifty Max Things"
}
}
}
}
},
"then": {
"properties": {
"field3": {
"properties": {
"field3dot2": {
"maximum": 50
}
}
},
"field4": {
"maximum": 50
}
}
}
},
{
"if": {
"properties": {
"field3": {
"properties": {
"field3dot1": {
"const": "Thousand Max Things"
}
}
}
}
},
"then": {
"properties": {
"field3": {
"properties": {
"field3dot2": {
"maximum": 1000
}
}
},
"field4": {
"maximum": 1000
}
}
}
}
]
}
Here is my UI Schema
{
"field2": {
"ui:help": "Depends on field1; if 'Ten Max', then this maximum is 10; if 'Fifty Max', then this maximum is 50; if 'Thousand Max', then this maximum is 1000"
},
"field3": {
"field3dot2": {
"ui:help": "Depends on field3dot1;if 'Ten Max Things', then this maximum is 10; if 'Fifty Max Things', then this maximum is 50; if 'Thousand Max Things', then this maximum is 1000"
}
},
"field4": {
"ui:help": "Depends on field3dot1;if 'Ten Max Things', then this maximum is 10; if 'Fifty Max Things', then this maximum is 50; if 'Thousand Max Things', then this maximum is 1000"
}
}
What is going on here? Why does my JSON schema form work in the json-schema-form-playground but not in Retool?
Self hosted Retool version 3.16.7