Lets say i've the following data structure
Option A
Option B
Option B1
Option B2.1
Option B2.2
I am trying to create an enums stucture that allows this so I can generate a dropdown based on the value of the previous selected dropdown.
Examples :
Select option A -> No additional dropdowns
Select option B -> Generate dropdown with Option B1
Select option B1 -> Generate dropdown with Option B2.1 and Option B2.2
This would work when you want to create an array with childeren is there anything similar possible for enums
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"medicine": {
"type": "object",
"properties": {
"value": { "type": "string" },
"categories": {
"type": "array",
"items": { "$ref": "#/definitions/medicine" }
}
}
}
},
"properties": {
"person": { "$ref": "#/definitions/medicine" }
}
}
And then the enum structure to be something like this
[
{
"value ": "Option A"
},
{
"value ": "Option B ",
"categories ": [
{
"value ": "Option B1 ",
"categories ": [
{
"value ": "Option B1.1"
},
{
"value ": "Option B1.2"
}
]
}
]
}
]
So I am looking for a data structure that would allow me to make dropdowns based on the values selected here in a own layout generation engine.