Open
Description
Describe the bug
Updating data for nested property with numeric key is working kinda funny 😅
For that kind of schema:
{
"type": "object",
"properties": {
"group-key": {
"type": "object",
"properties": {
"15": {
"type": "string"
}
}
}
},
}
updating data for property with "15" key will result in assigning to "group-key" an array of 16 elements where first 15 are null
and at index 15 you will have value that you entered.
Something like that:
{
"group-key": [
null, null, null, null, null,
null, null, null, null, null,
null, null, null, null, null,
"something"
]
}
Expected behavior
Expected data
would be:
{
"group-key": {
"15": "something"
}
}
Steps to reproduce the issue
- Create schema with nested numeric key:
{
"type": "object",
"properties": {
"group-key": {
"type": "object",
"properties": {
"15": {
"type": "string"
}
}
}
},
}
- Create UiSchema:
{
"type": "VerticalLayout",
"elements": [
{
"type": "Group",
"label": "Some Group",
"elements": [
{
"type": "Control",
"label": "Label",
"scope": "#/properties/group-key/properties/15"
}
]
}
]
}
- Enter some text in nested input
- See
data
of form:
{
"group": [
null, null, null, null, null,
null, null, null, null, null,
null, null, null, null, null,
"something"
]
}
Screenshots
No response
Which Version of JSON Forms are you using?
v3.2.1
Package
React Material Renderers
Additional context
{
"type": "object",
"properties": {
"group": {
"type": "object",
"properties": {
"15": {
"type": "string"
},
"non-numeric-key": {
"type": "string"
}
}
}
},
"required": []
}
if there are two nested field and firstly you will enter value for "non-numeric-key" then everything will work fine.
It will look like this:
{
"group-key": {
"non-numeric-key": "something"
}
}
then numeric key will be added correctly:
{
"group-key": {
"15": "hello there",
"non-numeric-key": "something"
}
}
But the other way will result in array with null
elements