Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mateuszkula opened this issue Sep 22, 2023 · 2 comments
Milestone

Comments

@mateuszkula
Copy link

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
  }
}
  1. 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

After changing data:
image

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.

@sdirix
Copy link
Member

sdirix commented Sep 22, 2023

Hi! Thanks for the report! The issue should be fixed by #2168 once merged. If you like you can test the PR on your side to verify whether your issues are resolved.

Thanks for the good writeup and the reproducible example :)

@sdirix sdirix added this to the next milestone Sep 22, 2023
@sdirix sdirix linked a pull request Sep 22, 2023 that will close this issue
@mateuszkula
Copy link
Author

Hi! I checked the PR and it seems that issue is still there - I will wait for PR to go out of "WIP" and recheck then ;) Thx for quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants