Skip to content

Commit ede8c1a

Browse files
author
Tihomir Surdilovic
authored
Add name prop to switch state data and event based conditions (#150)
Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent 820085f commit ede8c1a

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

schema/workflow.json

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,8 @@
938938
"description": "If eventConditions is used, defines the time period to wait for events (ISO 8601 format)"
939939
},
940940
"default": {
941-
"$ref": "#/definitions/defaultdef",
942-
"description": "Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition"
941+
"description": "Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition",
942+
"$ref": "#/definitions/defaultdef"
943943
},
944944
"dataInputSchema": {
945945
"type": "string",
@@ -1017,8 +1017,8 @@
10171017
}
10181018
},
10191019
"default": {
1020-
"$ref": "#/definitions/defaultdef",
1021-
"description": "Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition"
1020+
"description": "Default transition of the workflow if there is no matching data conditions. Can include a transition or end definition",
1021+
"$ref": "#/definitions/defaultdef"
10221022
},
10231023
"dataInputSchema": {
10241024
"type": "string",
@@ -1057,22 +1057,24 @@
10571057
"defaultdef": {
10581058
"type": "object",
10591059
"description": "Default definition. Can be either a transition or end definition",
1060+
"properties": {
1061+
"transition": {
1062+
"$ref": "#/definitions/transition"
1063+
},
1064+
"end": {
1065+
"$ref": "#/definitions/end"
1066+
}
1067+
},
10601068
"oneOf": [
10611069
{
1062-
"properties": {
1063-
"transition": {
1064-
"$ref": "#/definitions/transition"
1065-
}
1066-
},
1067-
"required": ["properties"]
1070+
"required": [
1071+
"transition"
1072+
]
10681073
},
10691074
{
1070-
"properties": {
1071-
"end": {
1072-
"$ref": "#/definitions/end"
1073-
}
1074-
},
1075-
"required": ["end"]
1075+
"required": [
1076+
"end"
1077+
]
10761078
}
10771079
]
10781080
},
@@ -1090,6 +1092,10 @@
10901092
"type": "object",
10911093
"description": "Switch state data event condition",
10921094
"properties": {
1095+
"name": {
1096+
"type": "string",
1097+
"description": "Event condition name"
1098+
},
10931099
"eventRef": {
10941100
"type" : "string",
10951101
"description": "References an unique event name in the defined workflow events"
@@ -1112,6 +1118,10 @@
11121118
"type": "object",
11131119
"description": "Switch state data event condition",
11141120
"properties": {
1121+
"name": {
1122+
"type": "string",
1123+
"description": "Event condition name"
1124+
},
11151125
"eventRef": {
11161126
"type" : "string",
11171127
"description": "References an unique event name in the defined workflow events"
@@ -1144,6 +1154,10 @@
11441154
"type": "object",
11451155
"description": "Switch state data based condition",
11461156
"properties": {
1157+
"name": {
1158+
"type": "string",
1159+
"description": "Data condition name"
1160+
},
11471161
"condition": {
11481162
"type": "string",
11491163
"description": "JsonPath expression evaluated against state data. True if results are not empty"
@@ -1162,6 +1176,10 @@
11621176
"type": "object",
11631177
"description": "Switch state data based condition",
11641178
"properties": {
1179+
"name": {
1180+
"type": "string",
1181+
"description": "Data condition name"
1182+
},
11651183
"condition": {
11661184
"type": "string",
11671185
"description": "JsonPath expression evaluated against state data. True if results are not empty"

specification.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,7 @@ If events defined in event-based conditions do not arrive before the states `eve
15971597

15981598
| Parameter | Description | Type | Required |
15991599
| --- | --- | --- | --- |
1600+
| name | Data condition name | string | no |
16001601
| condition | JsonPath expression evaluated against state data. True if results are not empty | string | yes |
16011602
| [transition](#Transitions) or [end](#End-Definition) | Defines what to do if condition is true. Transition to another state, or end workflow | object | yes |
16021603
| [metadata](#Workflow-Metadata) | Metadata information| object | no |
@@ -1614,6 +1615,7 @@ If events defined in event-based conditions do not arrive before the states `eve
16141615

16151616
```json
16161617
{
1618+
"name": "Eighteen or older",
16171619
"condition": "{{ $.applicants[?(@.age >= 18)] }}",
16181620
"transition": {
16191621
"nextState": "StartApplication"
@@ -1625,6 +1627,7 @@ If events defined in event-based conditions do not arrive before the states `eve
16251627
<td valign="top">
16261628

16271629
```yaml
1630+
name: Eighteen or older
16281631
condition: "{{ $.applicants[?(@.age >= 18)] }}"
16291632
transition:
16301633
nextState: StartApplication
@@ -1648,6 +1651,7 @@ to decide what to do, transition to another workflow state, or end workflow exec
16481651

16491652
| Parameter | Description | Type | Required |
16501653
| --- | --- | --- | --- |
1654+
| name | Event condition name | string | no |
16511655
| eventRef | References an unique event name in the defined workflow events | string | yes |
16521656
| [transition](#Transitions) or [end](#End-Definition) | Defines what to do if condition is true. Transition to another state, or end workflow | object | yes |
16531657
| [eventDataFilter](#event-data-filter) | Event data filter definition | object | no |
@@ -1666,6 +1670,7 @@ to decide what to do, transition to another workflow state, or end workflow exec
16661670

16671671
```json
16681672
{
1673+
"name": "Visa approved",
16691674
"eventRef": "visaApprovedEvent",
16701675
"transition": {
16711676
"nextState": "HandleApprovedVisa"
@@ -1677,6 +1682,7 @@ to decide what to do, transition to another workflow state, or end workflow exec
16771682
<td valign="top">
16781683

16791684
```yaml
1685+
name: Visa approved
16801686
eventRef: visaApprovedEvent
16811687
transition:
16821688
nextState: HandleApprovedVisa

0 commit comments

Comments
 (0)