Skip to content

Commit 48b15c3

Browse files
author
Tihomir Surdilovic
authored
Merge pull request #13 from tsurdilo/conditionname
Adding 'name' prop to switch state data and event-based conditions - …
2 parents babd0f7 + 2eb02e0 commit 48b15c3

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

api/src/main/resources/schema/switchconditions/datacondition.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
],
77
"description": "Switch state data based condition",
88
"properties": {
9+
"name": {
10+
"type": "string",
11+
"description": "Data condition name"
12+
},
913
"condition": {
1014
"type": "string",
1115
"description": "JsonPath expression evaluated against state data. True if results are not empty"

api/src/main/resources/schema/switchconditions/eventcondition.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"javaInterfaces": ["io.serverlessworkflow.api.interfaces.SwitchCondition"],
55
"description": "Switch state data event condition",
66
"properties": {
7+
"name": {
8+
"type": "string",
9+
"description": "Event condition name"
10+
},
711
"eventRef": {
812
"type" : "string",
913
"description": "References an unique event name in the defined workflow events"

api/src/test/resources/examples/creditcheck.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@
5252
"type": "switch",
5353
"dataConditions": [
5454
{
55+
"name": "Approved",
5556
"condition": "{{ $.creditCheck[?(@.decision == 'Approved')] }}",
5657
"transition": {
5758
"nextState": "StartApplication"
5859
}
5960
},
6061
{
62+
"name": "Denied",
6163
"condition": "{{ $.creditCheck[?(@.decision == 'Denied')] }}",
6264
"transition": {
6365
"nextState": "RejectApplication"

api/src/test/resources/examples/creditcheck.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ states:
3232
- name: EvaluateDecision
3333
type: switch
3434
dataConditions:
35-
- condition: "{{ $.creditCheck[?(@.decision == 'Approved')] }}"
35+
- name: Approved
36+
condition: "{{ $.creditCheck[?(@.decision == 'Approved')] }}"
3637
transition:
3738
nextState: StartApplication
38-
- condition: "{{ $.creditCheck[?(@.decision == 'Denied')] }}"
39+
- name: Denied
40+
condition: "{{ $.creditCheck[?(@.decision == 'Denied')] }}"
3941
transition:
4042
nextState: RejectApplication
4143
default:

0 commit comments

Comments
 (0)