FlowDrop Workflow Specification 1.0-draft

A switch compares its value; it does not evaluate it

Despite the parameter's name, a switch gateway runs no expression engine. The value is matched against each branch as it stands.

The rule

Normative: this is the rule
  1. A switch gateway does not evaluate its expression.
  2. The value is compared unchanged against each branch's value in declaration order, with no coercion: a branch matches only where the two are of the same type as well as equal.
  3. The first matching branch is the sole active branch, and its name is what the gateway reports as active.
  4. Where no branch matches, the branch named by default_branch is active; where no branch matches and no usable default is named, the node fails.

What it means

The parameter is named expression, but no expression engine ever sees it. A value that happens to look like a query — a JSONPath-shaped string, say — is still just a string, compared for exact equality against each branch's own value in the order the branches are declared. There is no coercion either: the comparison also requires the same type, so a value and a branch that would be equal after a type conversion still miss each other.

Only the first branch to match becomes active, and its declared name is what the gateway reports. Nothing matching falls through to the configured default branch; nothing matching and no usable default fails the node outright.

Example

A value shaped exactly like a JSONPath query, matched against a branch whose own configured value is that same literal string:

The expression and the branches it is compared against
{
  "expression": "$.user.role",
  "default_branch": "default",
  "branches": [
    { "name": "Admin", "value": "admin" },
    { "name": "Literal", "value": "$.user.role" }
  ]
}
The active branchactive
["Literal"]

The same strictness rules out a type match that a looser comparison would allow:

A string expression against a branch whose value is the integer 1
{ "expression": "1", "default_branch": "Fallback", "branches": [{ "name": "IntOne", "value": 1 }] }
The active branchactive
["Fallback"]

"1" and 1 are equal after conversion but not of the same type, so the comparison misses and the configured default branch, Fallback, is what activates.

Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0-draft · LANG-27 · changed in spec 1.0