Logic And Routing
What this category is for
Use these nodes to make branching decisions, validate payloads, choose route-specific behavior at runtime, and iterate over collections.
Node list table
| Node type | Purpose | Key inputs | Branch outputs |
|---|---|---|---|
condition_node | Evaluates ordered JavaScript boolean expressions and picks the first matching output. | Config conditions[] (condition, output), default_output | dynamic (configured), typically default fallback |
validate_node | Validates a value against JSON Schema and routes by validity. | Config schema (required), input value | valid, invalid |
switch_node | Matches a single evaluated value against cases and routes to case output. | Config value_expression, cases[], default_output | dynamic (configured), typically default fallback |
loop_node | Evaluates an array expression; Loop output runs the body once per element; Done runs after all iterations. | Config array_expression, optional max_iterations (current element is always item / $json['$item']) | Edges: sourceHandle loop / done; output results, count |
Common patterns
1) Request contract gate
http_trigger->validate_nodevalid-> business flowinvalid->response_nodewith 400 andvalidation_errors
2) HTTP status routing
proxy_nodeorhttp_request_node->switch_nodevalue_expression={{ $json['node_id'].response.status_code }}- Cases:
200,404,429to separate handling branches
3) Business policy routing
condition_nodewith ordered rules:- High-risk path
- Privileged client path
- Default standard path
- Stop evaluation on first true condition
4) Multi-step validation
- Schema validation in
validate_node - Then
condition_nodefor semantic checks that JSON Schema cannot express easily
5) Batch per-item work
http_trigger→loop_nodewitharray_expressionpointing atrequest.body.items(or similar)- Loop →
http_request_node(orset_node,code_node) using$json['$item']/$json['$index']in inputs - Loop →
response_nodereturning{{ $json['loop_1'].results }}(replace node id)
Common mistakes and how to debug
- Expression format mismatch:
switch_node.value_expressionuses wrapped expressions ({{ ... }}), whilecondition_node.conditionis plain JavaScript expression text. - No branch connected for selected output: node may set
matched_output, but workflow has no edge for that source handle. Verify edge handles exactly match output names. - Invalid schema object:
validate_nodereturnsinvalidwith schema compile errors. Validate schema independently first, then paste. - Case typing confusion in
switch_node: comparison is string-based (fmt.Sprint). Match literal values as strings in cases. - Default branch overused: if all traffic goes to default, inspect evaluated value and upstream node IDs referenced in expressions.
- Loop node:
array_expressionmust evaluate to an array; exceedingmax_iterationsfails the run. Inside the body, use$json['$item']/$json['$index']/$json['$loop'](see Loop Node).