eclipsesource / jsonforms

Customizable JSON Schema-based forms with React, Angular and Vue support out of the box.
http://jsonforms.io
Other
2.17k stars 361 forks source link

Wrong key for Array item if specific item is selected #2096

Open Fankhauser-Dominik opened 1 year ago

Fankhauser-Dominik commented 1 year ago

Describe the bug

When I select a single item from an array through the uischema, I get a wrong key. I think it is because of the items object. If I do the same with a normal object (without items) instead of an array, then I get the expected result.

schema ``` { "definitions": { "order": { "type": "object", "properties": { "title": { "type": "string", "minLength": 5 }, "ordered": { "type": "boolean" }, "assignee": { "type": "string" }, "choices": { "type": "array", "items": { "type": "string" } } }, "required": ["title"] } }, "type": "object", "properties": { "orders": { "type": "array", "items": { "$ref": "#/definitions/order", "format": "html", "title": "Multi Text Area" } } } } ```
uischema ``` { "type": "VerticalLayout", "elements": [ { "type": "Control", "scope": "#/properties/orders/items/properties/title" } ] } ```

If got the following data:

{
  "orders": {
    "properties": "Test"
  }
}

Expected behavior

I expect this output:

{
  "orders": {
    "title": "Test"
  }
}

Steps to reproduce the issue

  1. clone this repo: Fankhauser-Dominik/jsonforms-react-seed
  2. Play around...

Screenshots

No response

In which browser are you experiencing the issue?

Not relevant

Which Version of JSON Forms are you using?

v3.0.0

Framework

React

RendererSet

Material

Additional context

No response

sdirix commented 1 year ago

Hi @Fankhauser-Dominik, we don't really support rendering controls of (nested) array elements outside of an array control which is why I'm not surprised that it fails at the data path calculation.

What exactly is the use case? Would you like to refer to the first element of the array then? Why not use a regular array control?