jsonforms icon indicating copy to clipboard operation
jsonforms copied to clipboard

Wrong key for Array item if specific item is selected

Open Fankhauser-Dominik opened this issue 2 years ago • 1 comments

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

Fankhauser-Dominik avatar Feb 17 '23 18:02 Fankhauser-Dominik

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?

sdirix avatar Feb 20 '23 08:02 sdirix