JSON Editor doesn't create Dropdowns for Arrays
JSON Editor won't create Dropdowns for Object Property, if the objects are in an array.
So I've been using JSON Schema enum's to make the app's stakeholders life easier (and validate the input), but I've noticed a weird bug when using array of objects. Basically, a Popover dialog will be shown for the property that says "should be equal to A, B, or C", but dropdown won't be displayed.
I've tried using enum on a object property (object not in an array), and Dropdowns are being rendered as defined.
Came here looking for a solution for the same problem.
Probably same issue reported over here: https://github.com/josdejong/jsoneditor/issues/1404
To confirm and further explain my problem, here is a little demonstration:
Array of Objects, dropdown selector don't appear for 'material' dropdown even though I have enum defined. Only showing "should be one of..." https://jsoneditoronline.org/#right=cloud.cb1dfeb53a204e65a2f9993854ad9a37&left=cloud.a82449cff4304e0f8b8e496d3fba433e
Just a single object with materials property, same structure but enum dropdown is being rendered when entering the 'material' values. https://jsoneditoronline.org/#right=cloud.cb1dfeb53a204e65a2f9993854ad9a37&left=cloud.a82449cff4304e0f8b8e496d3fba433e
Thanks for reporting. I'll paste the code example from @KIKOmanasijev here so we will not lose it in the future:
Schema:
{
"type": "object",
"properties": {
"colors": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"material": {
"type": "string",
"enum": [ "green", "yellow", "red" ]
}
}
}
]
}
}
}
Document:
{
"colors": [
{
"material": "dark"
}
]
}
Help debugging this would be welcome. Anyone?