Skip to content

Commit d75f692

Browse files
committed
Fix #862 - Switch 'then' must accept free strings
Signed-off-by: Ricardo Zanini <[email protected]>
1 parent d94c7d6 commit d75f692

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

examples/switch-then-string.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: sample-workflow
5+
version: '0.1.0'
6+
do:
7+
processOrder:
8+
switch:
9+
case1:
10+
when: .orderType == "electronic"
11+
then: processElectronicOrder
12+
case2:
13+
when: .orderType == "physical"
14+
then: processPhysicalOrder
15+
default:
16+
then: handleUnknownOrderType
17+
processElectronicOrder:
18+
execute:
19+
sequentially:
20+
validatePayment:
21+
set:
22+
validate: true
23+
fulfillOrder:
24+
set:
25+
status: fulfilled
26+
then: exit
27+
processPhysicalOrder:
28+
execute:
29+
sequentially:
30+
checkInventory:
31+
set:
32+
inventory: clear
33+
packItems:
34+
set:
35+
items: 1
36+
scheduleShipping:
37+
set:
38+
address: Elmer St
39+
then: exit
40+
handleUnknownOrderType:
41+
execute:
42+
sequentially:
43+
logWarning:
44+
set:
45+
log: warn
46+
notifyAdmin:
47+
set:
48+
message: something's wrong

schema/workflow.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,12 @@ $defs:
325325
required: [ emit ]
326326
description: Allows workflows to publish events to event brokers or messaging systems, facilitating communication and coordination between different components and services.
327327
flowDirective:
328-
type: string
329-
enum: [ continue, exit, end ]
330-
default: continue
328+
additionalProperties: false
329+
anyOf:
330+
- type: string
331+
enum: [ continue, exit, end ]
332+
default: continue
333+
- type: string
331334
forTask:
332335
properties:
333336
for:

0 commit comments

Comments
 (0)