Hide/Show rules get ignored in nested uischema structure

Hi,

I have three rules in my jsonForm. The global rule showIfKubernetes is currently always true. Then two sub-rules, showIfStandalone and showIfSidecar, depend on a select elsewhere.

Controls namespace, deploymentName and port are only supposed to SHOW when the showIfSidecar condition is true. However they always show, both in standalone and sidecar modes. I can always see an element which has the showIfSidecar rule attached to it.

I have tried editing the scope to just use #/properties/ingress instead of #/properties/ingress/properties/install. And it works better but I need to have control over each Control independently.

const showIfKubernetes = {
  effect: "SHOW",
  condition: {
    scope: "#/properties/deploymentMode",
    schema: { enum: ["Kubernetes - Standalone", "Kubernetes - Sidecar"] },
  },
}

const showIfStandalone = {
  effect: "SHOW",
  condition: {
    scope: "#/properties/deploymentMode",
    schema: { enum: ["Kubernetes - Standalone"] },
  },
}

const showIfSidecar = {
  effect: "SHOW",
  condition: {
    scope: "#/properties/deploymentMode",
    schema: { enum: ["Kubernetes - Sidecar"] },
  },
}

Then my uiSchema looks like this

{
      type: "VerticalLayout",
      rule: hideIfDemo,
      elements: [
        {
          type: "Control",
          scope: "#/properties/name",
        },
        {
          type: "Control",
          scope: "#/properties/deploymentMode",
          options: {
            format: "radio",
          },
        },
        {
          rule: showIfKubernetes,
          type: "Control",
          label: "Redis settings",
          scope: "#/properties/redis",
        },
        {
          rule: showIfKubernetes,
          type: "Group",
          label: "Ingress settings",
          elements: [
            {
              type: "Control",
              scope: "#/properties/ingress/properties/install",
              rule: showIfStandalone,
            },
            {
              type: "Control",
              scope: "#/properties/ingress/properties/serviceType",
              rule: showIfStandalone,
              options: { format: "radio" },
            },
            {
              type: "Control",
              scope: "#/properties/ingress/properties/namespace",
              rule: showIfSidecar,
            },
            {
              type: "Control",
              scope: "#/properties/ingress/properties/deploymentName",
              rule: showIfSidecar,
            },
            {
              type: "Control",
              scope: "#/properties/ingress/properties/port",
              rule: showIfSidecar,
            },
          ],
        },
        {
          rule: showIfStandalone,
          type: "Control",
          label: "Initial worker settings",
          scope: "#/properties/worker",
        },
      ],
    },

Hi @Adborowski,

please post a full JSON Schema and UI Schema as then it is much easier for us to reproduce the issue.

I used the following schema and uischema and could not reproduce the problem:

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "title": "Name"
    },
    "deploymentMode": {
      "type": "string",
      "title": "Deployment Mode",
      "enum": ["Kubernetes - Standalone", "Kubernetes - Sidecar"],
      "default": "Kubernetes - Standalone"
    },
    "redis": {
      "type": "boolean"
    },
    "ingress": {
      "type": "object",
      "title": "Ingress settings",
      "properties": {
        "install": {
          "type": "boolean",
          "title": "Install"
        },
        "serviceType": {
          "type": "string",
          "title": "Service Type",
          "enum": ["ClusterIP", "NodePort", "LoadBalancer"],
          "default": "ClusterIP"
        },
        "namespace": {
          "type": "string",
          "title": "Namespace"
        },
        "deploymentName": {
          "type": "string",
          "title": "Deployment Name"
        },
        "port": {
          "type": "integer",
          "title": "Port"
        }
      }
    },
    "worker": {
      "type": "string"
    }
  },
  "required": ["name", "deploymentMode"]
}
{
  "type": "VerticalLayout",
  "elements": [
    {
      "type": "Control",
      "scope": "#/properties/name"
    },
    {
      "type": "Control",
      "scope": "#/properties/deploymentMode",
      "options": {
        "format": "radio"
      }
    },
    {
      "rule": {
        "effect": "SHOW",
        "condition": {
          "scope": "#/properties/deploymentMode",
          "schema": {
            "enum": ["Kubernetes - Standalone", "Kubernetes - Sidecar"]
          }
        }
      },
      "type": "Control",
      "label": "Redis settings",
      "scope": "#/properties/redis"
    },
    {
      "rule": {
        "effect": "SHOW",
        "condition": {
          "scope": "#/properties/deploymentMode",
          "schema": {
            "enum": ["Kubernetes - Standalone", "Kubernetes - Sidecar"]
          }
        }
      },
      "type": "Group",
      "label": "Ingress settings",
      "elements": [
        {
          "type": "Control",
          "scope": "#/properties/ingress/properties/install",
          "rule": {
            "effect": "SHOW",
            "condition": {
              "scope": "#/properties/deploymentMode",
              "schema": {
                "enum": ["Kubernetes - Standalone"]
              }
            }
          }
        },
        {
          "type": "Control",
          "scope": "#/properties/ingress/properties/serviceType",
          "rule": {
            "effect": "SHOW",
            "condition": {
              "scope": "#/properties/deploymentMode",
              "schema": {
                "enum": ["Kubernetes - Standalone"]
              }
            }
          },
          "options": {
            "format": "radio"
          }
        },
        {
          "type": "Control",
          "scope": "#/properties/ingress/properties/namespace",
          "rule": {
            "effect": "SHOW",
            "condition": {
              "scope": "#/properties/deploymentMode",
              "schema": {
                "enum": ["Kubernetes - Sidecar"]
              }
            }
          }
        },
        {
          "type": "Control",
          "scope": "#/properties/ingress/properties/deploymentName",
          "rule": {
            "effect": "SHOW",
            "condition": {
              "scope": "#/properties/deploymentMode",
              "schema": {
                "enum": ["Kubernetes - Sidecar"]
              }
            }
          }
        },
        {
          "type": "Control",
          "scope": "#/properties/ingress/properties/port",
          "rule": {
            "effect": "SHOW",
            "condition": {
              "scope": "#/properties/deploymentMode",
              "schema": {
                "enum": ["Kubernetes - Sidecar"]
              }
            }
          }
        }
      ]
    },
    {
      "rule": {
        "effect": "SHOW",
        "condition": {
          "scope": "#/properties/deploymentMode",
          "schema": {
            "enum": ["Kubernetes - Standalone"]
          }
        }
      },
      "type": "Control",
      "label": "Initial worker settings",
      "scope": "#/properties/worker"
    }
  ]
}

NestedRules