# Hide/Show rules get ignored in nested uischema structure

**URL:** <https://jsonforms.discourse.group/t/hide-show-rules-get-ignored-in-nested-uischema-structure/2163>\
**Category:** General\
**Created:** [May 29, 2024, 8:45am UTC](https://jsonforms.discourse.group/t/hide-show-rules-get-ignored-in-nested-uischema-structure/2163 "2024-05-29T08:45:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adborowski](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/adborowski/32/1025_2.png) [@Adborowski](https://jsonforms.discourse.group/u/Adborowski)\
**Post date:** [May 29, 2024, 8:45am UTC](https://jsonforms.discourse.group/t/hide-show-rules-get-ignored-in-nested-uischema-structure/2163/1 "2024-05-29T08:45:40Z")

</div>

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.

```auto
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

```auto
{
      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",
        },
      ],
    },

```

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [May 31, 2024, 4:09pm UTC](https://jsonforms.discourse.group/t/hide-show-rules-get-ignored-in-nested-uischema-structure/2163/2 "2024-05-31T16:09:38Z")

</div>

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:

```auto
{
  "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"]
}

```

```auto
{
  "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](https://global.discourse-cdn.com/free1/uploads/jsonforms/original/2X/e/ee9c598209f4490c54d175965974306462190551.gif)
