Skip to main content
Evaluates cases in order and renders the first match. Falls back to the else branch if no case matches. Produced by grouping consecutive If/Elif/Else siblings in the Python DSL.
{
  "type": "object",
  "properties": {
    "type": {
      "const": "Condition",
      "default": "Condition",
      "type": "string"
    },
    "cases": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "when": {
            "type": "string",
            "description": "Expression to evaluate (raw expression, not a {{ }} template)"
          },
          "children": {
            "type": "array",
            "items": { "$ref": "Component" }
          }
        },
        "required": ["when"]
      },
      "minItems": 1,
      "description": "Ordered branches — first truthy `when` wins"
    },
    "else": {
      "type": "array",
      "items": { "$ref": "Component" },
      "description": "Components to render when no case matches"
    }
  },
  "required": [
    "type",
    "cases"
  ]
}