In the *.props.json file I am able to add properties for objects that either show up as default or can be added from designer by pressing the +
button. I can also add description to objects and primitive types inside the objects.
However for arrays containing objects, I have only been able to get them pre-filled by including entire array as default
. For properties
I have only been able to add empty arrays via the +
button in the designer.
-
Is it possible to define properties
that can get added inside array by pressing the +
in the designer like we are able to do for other objects?
-
Is it possible to add descriptions to the parameters inside the array?
The problem here is probably our JSON editor not being 'smart' enough to recognize these situations and autocomplete accordingly. I don't think we have any e.g. Perspective components where this currently works (correct me if I'm wrong) so we would have to treat this as a feature request for the JSON editor.
I think this is what you're looking for.
Use the "items" keyword do define the properties of the array items:
"myArray": {
"type": "array",
"items": {
"type": "object",
"description": "Some description",
"properties": {
"label": {
"type": "string",
"description": "Some description",
"default": "Label"
},
"value": {
"type": "number",
"description": "Some description",
"default": 0
}
}
},
"description": "An array of values with label",
"default": []
}
1 Like