From d75f692432c55bf8e72aa0e8e8c3a3fc936810b8 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Wed, 29 May 2024 14:11:17 -0300 Subject: [PATCH] Fix #862 - Switch 'then' must accept free strings Signed-off-by: Ricardo Zanini --- examples/switch-then-string.yaml | 48 ++++++++++++++++++++++++++++++++ schema/workflow.yaml | 9 ++++-- 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 examples/switch-then-string.yaml diff --git a/examples/switch-then-string.yaml b/examples/switch-then-string.yaml new file mode 100644 index 00000000..7db53745 --- /dev/null +++ b/examples/switch-then-string.yaml @@ -0,0 +1,48 @@ +document: + dsl: '1.0.0-alpha1' + namespace: test + name: sample-workflow + version: '0.1.0' +do: + processOrder: + switch: + case1: + when: .orderType == "electronic" + then: processElectronicOrder + case2: + when: .orderType == "physical" + then: processPhysicalOrder + default: + then: handleUnknownOrderType + processElectronicOrder: + execute: + sequentially: + validatePayment: + set: + validate: true + fulfillOrder: + set: + status: fulfilled + then: exit + processPhysicalOrder: + execute: + sequentially: + checkInventory: + set: + inventory: clear + packItems: + set: + items: 1 + scheduleShipping: + set: + address: Elmer St + then: exit + handleUnknownOrderType: + execute: + sequentially: + logWarning: + set: + log: warn + notifyAdmin: + set: + message: something's wrong \ No newline at end of file diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 018fdb2e..bd6b1b9e 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -325,9 +325,12 @@ $defs: required: [ emit ] description: Allows workflows to publish events to event brokers or messaging systems, facilitating communication and coordination between different components and services. flowDirective: - type: string - enum: [ continue, exit, end ] - default: continue + additionalProperties: false + anyOf: + - type: string + enum: [ continue, exit, end ] + default: continue + - type: string forTask: properties: for: