eclipsesource / eclipsesource/jsonforms

Square brackets in property name causes object to be destructured to many nested objects

Aperta
#2,178 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug core
Lingua principale
TypeScript
Stelle
2.7k
Fork
424
Merge medio
17g 8h
PR unite (30g)
1

Descrizione

### Describe the bug

Names of properties cannot have square brackets inside. After changing initial data property name gets restructured in nested object.

### Expected behavior

Structure of data object does not change

### Steps to reproduce the issue

1. Clone `https://github.com/mateuszkula/jsonforms-react-error`
2. Run `npm ci` & `npm run start`
3. Go to `localhost:3000`
4. Find Input for label `A` -> type 1 in field `Min`
5. Data changes from:
```
{
"a[b][c][d]": {
"min": 0,
"max": 1
},
"a": {
"min": 1,
"max": 1
}
}
```
to
```
{
"a[b][c][d]": {
"min": 0,
"max": 1
},
"a": {
"min": 0,
"max": 1
}
}
```
6. Modify `Min` field for `A B C D` and type some number there. Data changes from:
```
{
"a[b][c][d]": {
"min": 0,
"max": 1
},
"a": {
"min": 1,
"max": 1
}
}
```
to
```
{
"a[b][c][d]": {
"min": 0,
"max": 1
},
"a": {
"min": 1,
"max": 1,
"b": {
"c": {
"d": {
"min": 3
}
}
}
}
}
```

### Screenshots

Before entering data:
![image](https://github.com/eclipsesource/jsonforms/assets/30259869/ef846713-b5e5-4c7f-b853-985d0338db29)

After changing data:
![image](https://github.com/eclipsesource/jsonforms/assets/30259869/16ad8733-4b71-4d4e-a562-5f32c20d8e16)

### In which browser are you experiencing the issue?

Firefox 117.0.1 (64-bit) / Chrome Version 116.0.5845.187 (Official Build) (arm64)

### Which Version of JSON Forms are you using?

v3.1.0

### Framework

Core, React

### RendererSet

Material

### Additional context

I think quite similar issue is described in `https://github.com/eclipsesource/jsonforms/issues/2102` but i could not force it to behave in same wrong way like in my example.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Clona la riproduzione jsonforms-react-error collegata, esegui `npm ci` e `npm run start` e segui i passaggi Min-field riportati per `A` e `A B C D`. Indaga sul motivo per cui la modifica di questi campi trasforma `a[b][c][d]` in oggetti annidati; il lavoro è completato quando l'oggetto dati conserva il nome letterale della proprietà e la struttura.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
react, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.