Skip to content

Reference a property outside of the array #2094

Open
@luiz290788

Description

@luiz290788

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

{
  "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

{
  "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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions