How to apply composable condition in uischema?

When you want to cover multiple attributes, then you need to choose a scope which can cover both. Then within the schema field you need to specify a schema which will validate successfully whenever your effect shall apply.

JSON Schema:

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "yesOrNo": {
      "type": "string",
      "enum": [
        "yes",
        "no"
      ]
    }
  }
}

UI Schema:

{
  "type": "VerticalLayout",
  "elements": [
    {
      "type": "Control",
      "scope": "#/properties/name",
      "rule": {
        "effect": "DISABLE",
        "condition": {
          "scope": "#",
          "schema": {
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "const": ""
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "yesOrNo": {
                    "const": "yes"
                  }
                },
                "required": [
                  "yesOrNo"
                ]
              }
            ]
          }
        }
      }
    },
    {
      "type": "Control",
      "scope": "#/properties/yesOrNo"
    }
  ]
}

The schema in the rule is scoped against the root object. It will validate successfully when

  • yesOrNo exists and is set to yes AND

  • name either doesn’t exist or is empty

Note that this is nothing special about JSON Forms and just regular JSON Schema validation.