eclipsesource / eclipsesource/jsonforms

Reference a property outside of the array

Open
#2,094 2 comments 0 reactions 0 assignees View on GitHub
core enhancement
Dominant language
TypeScript
Stars
2.7k
Forks
424
Avg merge
17d 8h
Merged PRs (30d)
1

Description

### Is your feature request related to a problem? Please describe.

I need a way to reference a property outside of an array while evaluating a condition inside of the array.

Here is my example:

schema

```json
{
"type": "object",
"properties": {
"a": {
"type": "string",
"enum": ["Yes", "No"]
},

"b": {
"type": "array",
"minItems": 1,
"maxItems": 5,
"items": {
"type": "object",
"properties": {
"c": { "type": "string" },
"d": { "type": "string" }
},
"required": ["c"]
}
}
},
"required": ["a", "b"]
}
```

uischema

```json
{
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/a" <-- How to reference this value from inside of the array?
},
{
"type": "Control",
"scope": "#/properties/b",
"options": {
"detail": {
"type": "VerticalLayout",
"elements": [
{ "type": "Control", "scope": "#/properties/c" },
{
"type": "Control",
"scope": "#/properties/d",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/a", <-- I want the condition to be here
"schema": { "const": "Yes" }
}
}
}
]
}
}
}
]
}
```

I was able to reference other values in the same item of the array, which I will need as well, but is there a way to reference values outside of the array item? It looks like that all paths in the array are scoped to that specific array item.

### Describe the solution you'd like

A way to specify a that a path is in the current item of the array or outside of the array. Both cases are valid and should be allowed.

### Describe alternatives you've considered

I can (I will probably do that in my application) explode the items of the array into individual items so I can reference things outside of it. The problem is that I lose all the controls and ui elements for controlling the array. I will need to implement that manually.

### Framework

React

### RendererSet

Material

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.