Switch

Switch

Match a value against several cases and run the first one that matches

Fields

FieldTypeRequiredDescription
valueoperand ({path} or {literal})yesThe value to match.
casesarray of {when: operand, steps}, non-emptyyesMatching is strict equality only — the first case whose 'when' equals 'value' runs.
defaultarray of stepsnoRuns if no case matches.

Example

{
  "id": "01H8XGJVBWX7Y5Z3K9M2N4P6Q1",
  "type": "switch",
  "value": {
    "path": "vars.run.choice"
  },
  "cases": [
    {
      "when": {
        "literal": "a"
      },
      "steps": []
    }
  ],
  "default": []
}

Did this page help you?