Skip to content

Commit bbad386

Browse files
authored
Add clarification on mutually exclusive properties (#566)
* Add clarification on mutually exclusive properties Signed-off-by: Tihomir Surdilovic <tihomir@temporal.io> * fixing errors Signed-off-by: Tihomir Surdilovic <tihomir@temporal.io>
1 parent 4301c43 commit bbad386

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

roadmap/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ _Status description:_
2626
| ✔️| Fix support for workflow extensions | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
2727
| ✔️| Fix state execution timeout | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
2828
| ✔️| Update rules of retries increment and multiplier properties | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
29+
| ✔️| Add clarification on mutually exclusive properties | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
2930
| ✏️️| Add inline state defs in branches | |
3031
| ✏️️| Update rest function definition | |
3132
| ✏️️| Add "completedBy" functionality | |

specification.md

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,9 +2175,9 @@ Serverless Workflow defines the following Workflow States:
21752175
| [onEvents](#OnEvents-Definition) | Define the events to be consumed and optional actions to be performed | array | yes |
21762176
| [timeouts](#Workflow-Timeouts) | State specific timeout settings | object | no |
21772177
| [stateDataFilter](#State-data-filters) | State data filter definition| object | no |
2178-
| [transition](#Transitions) | Next transition of the workflow after all the actions have been performed | object | yes |
2178+
| [transition](#Transitions) | Next transition of the workflow after all the actions have been performed | object | yes if "end" is not defined |
21792179
| [onErrors](#Error-Definition) | States error handling definitions | array | no |
2180-
| [end](#End-Definition) | Is this state an end state | object | no |
2180+
| [end](#End-Definition) | Is this state an end state | object | yes, if "transition" is not defined |
21812181
| [compensatedBy](#Workflow-Compensation) | Unique name of a workflow state which is responsible for compensation of this state | String | no |
21822182
| [metadata](#Workflow-Metadata) | Metadata information| object | no |
21832183

@@ -2311,6 +2311,8 @@ The `timeouts` property can be used to define state specific timeout settings. E
23112311
For more information about Event state specific event timeout settings reference [this section](#Event-Timeout-Definition).
23122312
For more information about workflow timeouts reference the [Workflow Timeouts](#Workflow-Timeouts) section.
23132313

2314+
Note that `transition` and `end` properties are mutually exclusive, meaning that you cannot define both of them at the same time.
2315+
23142316
##### Operation State
23152317

23162318
| Parameter | Description | Type | Required |
@@ -2534,6 +2536,7 @@ Sleep state
25342536
suspends workflow execution for a given time duration. The delay is defined in its `duration` property using the ISO 8601
25352537
duration format.
25362538

2539+
Note that `transition` and `end` properties are mutually exclusive, meaning that you cannot define both of them at the same time.
25372540
##### Parallel State
25382541

25392542
| Parameter | Description | Type | Required |
@@ -2547,11 +2550,11 @@ duration format.
25472550
| [timeouts](#Workflow-Timeouts) | State specific timeout settings | object | no |
25482551
| [stateDataFilter](#State-data-filters) | State data filter | object | no |
25492552
| [onErrors](#Error-Definition) | States error handling and retries definitions | array | no |
2550-
| [transition](#Transitions) | Next transition of the workflow after all branches have completed execution | object | yes (if end is not defined) |
2553+
| [transition](#Transitions) | Next transition of the workflow after all branches have completed execution | object | yes if "end" is not defined |
25512554
| [compensatedBy](#Workflow-Compensation) | Unique name of a workflow state which is responsible for compensation of this state | String | no |
25522555
| [usedForCompensation](#Workflow-Compensation) | If true, this state is used to compensate another state. Default is "false" | boolean | no |
25532556
| [metadata](#Workflow-Metadata) | Metadata information| object | no |
2554-
| [end](#End-Definition) | If this state and end state | object | no |
2557+
| [end](#End-Definition) | If this state and end state | object | yes if "transition" is not defined |
25552558

25562559
<details><summary><strong>Click to view example definition</strong></summary>
25572560
<p>
@@ -2647,6 +2650,8 @@ The `timeouts` property can be used to set state specific timeout settings. Para
26472650
`stateExecTimeout` and `branchExecTimeout` timeout settings. For more information on workflow timeouts
26482651
reference the [Workflow Timeouts](#Workflow-Timeouts) section.
26492652

2653+
Note that `transition` and `end` properties are mutually exclusive, meaning that you cannot define both of them at the same time.
2654+
26502655
##### Inject State
26512656

26522657
| Parameter | Description | Type | Required |
@@ -2656,11 +2661,11 @@ reference the [Workflow Timeouts](#Workflow-Timeouts) section.
26562661
| type | State type | string | yes |
26572662
| data | JSON object which can be set as state's data input and can be manipulated via filter | object | yes |
26582663
| [stateDataFilter](#state-data-filters) | State data filter | object | no |
2659-
| [transition](#Transitions) | Next transition of the workflow after injection has completed | object | yes (if end is set to false) |
2664+
| [transition](#Transitions) | Next transition of the workflow after injection has completed | object | yes if "end" is set to false |
26602665
| [compensatedBy](#Workflow-Compensation) | Unique name of a workflow state which is responsible for compensation of this state | String | no |
26612666
| [usedForCompensation](#Workflow-Compensation) | If true, this state is used to compensate another state. Default is "false" | boolean | no |
26622667
| [metadata](#Workflow-Metadata) | Metadata information| object | no |
2663-
| [end](#End-Definition) | If this state and end state | object | no |
2668+
| [end](#End-Definition) | If this state and end state | object | yes if "transition" is not defined |
26642669

26652670
<details><summary><strong>Click to view example definition</strong></summary>
26662671
<p>
@@ -2876,6 +2881,8 @@ The `timeouts` property can be used to define state specific timeout settings. I
28762881
`stateExecTimeout` property. For more information on workflow timeouts reference the
28772882
[Workflow Timeouts](#Workflow-Timeouts) section.
28782883

2884+
Note that `transition` and `end` properties are mutually exclusive, meaning that you cannot define both of them at the same time.
2885+
28792886
##### ForEach State
28802887

28812888
| Parameter | Description | Type | Required |
@@ -2892,11 +2899,11 @@ The `timeouts` property can be used to define state specific timeout settings. I
28922899
| [timeouts](#Workflow-Timeouts) | State specific timeout settings | object | no |
28932900
| [stateDataFilter](#State-data-filters) | State data filter definition | object | no |
28942901
| [onErrors](#Error-Definition) | States error handling and retries definitions | array | no |
2895-
| [transition](#Transitions) | Next transition of the workflow after state has completed | object | yes (if end is not defined) |
2902+
| [transition](#Transitions) | Next transition of the workflow after state has completed | object | yes if "end" is not defined |
28962903
| [compensatedBy](#Workflow-Compensation) | Unique name of a workflow state which is responsible for compensation of this state | String | no |
28972904
| [usedForCompensation](#Workflow-Compensation) | If true, this state is used to compensate another state. Default is "false" | boolean | no |
28982905
| [metadata](#Workflow-Metadata) | Metadata information| object | no |
2899-
| [end](#End-Definition) | Is this state an end state | object | no |
2906+
| [end](#End-Definition) | Is this state an end state | object | yes if "transition" is not defined |
29002907

29012908
<details><summary><strong>Click to view example definition</strong></summary>
29022909
<p>
@@ -3118,6 +3125,8 @@ The `timeouts` property can be used to set state specific timeout settings. ForE
31183125
`stateExecTimeout` and `actionExecTimeout` settings. For more information on workflow timeouts reference the [Workflow Timeouts](#Workflow-Timeouts)
31193126
section.
31203127

3128+
Note that `transition` and `end` properties are mutually exclusive, meaning that you cannot define both of them at the same time.
3129+
31213130
##### Callback State
31223131

31233132
| Parameter | Description | Type | Required |
@@ -3131,8 +3140,8 @@ section.
31313140
| [eventDataFilter](#Event-data-filters) | Callback event data filter definition | object | no |
31323141
| [stateDataFilter](#State-data-filters) | State data filter definition | object | no |
31333142
| [onErrors](#Error-Definition) | States error handling and retries definitions | array | no |
3134-
| [transition](#Transitions) | Next transition of the workflow after callback event has been received | object | yes |
3135-
| [end](#End-Definition) | Is this state an end state | object | no |
3143+
| [transition](#Transitions) | Next transition of the workflow after callback event has been received | object | yes if "end" is not defined |
3144+
| [end](#End-Definition) | Is this state an end state | object | yes if "transition" is not defined |
31363145
| [compensatedBy](#Workflow-Compensation) | Uniaue name of a workflow state which is responsible for compensation of this state | String | no |
31373146
| [usedForCompensation](#Workflow-Compensation) | If true, this state is used to compensate another state. Default is "false" | boolean | no |
31383147
| [metadata](#Workflow-Metadata) | Metadata information| object | no |
@@ -3216,6 +3225,8 @@ The `timeouts` property defines state specific timeout settings. Callback states
32163225
For more information on workflow timeouts reference the [Workflow Timeouts](#Workflow-Timeouts)
32173226
section.
32183227

3228+
Note that `transition` and `end` properties are mutually exclusive, meaning that you cannot define both of them at the same time.
3229+
32193230
#### Related State Definitions
32203231

32213232
##### Function Definition
@@ -3792,7 +3803,7 @@ Service invocation can be done in two different ways:
37923803
* Reference a `produced` and `consumed` [event definitions](#Event-Definition) via the `eventRef` property.
37933804
* Reference a sub-workflow invocation via the `subFlowRef` property.
37943805

3795-
Note that `functionRef`, `eventRef`, and `subFlowRef` are mutually exclusive, meaning that only of of them can be
3806+
Note that `functionRef`, `eventRef`, and `subFlowRef` are mutually exclusive, meaning that only one of them can be
37963807
specified in a single action definition.
37973808

37983809
The `name` property specifies the action name.
@@ -4079,8 +4090,7 @@ If it is set to `continue`, if the parent workflow completes, the subflow execut
40794090

40804091
| Parameter | Description | Type | Required |
40814092
| --- | --- | --- | --- |
4082-
| errorRef | Reference to a unique workflow error definition | string | yes if errorRefs is not used |
4083-
| errorRefs | Reference one or more unique workflow error definition | array | yes if errorRef is not used |
4093+
| errorRef or errorRefs | Reference one unique workflow error definition, or multiple unique workflow error definitions | string (errorRef) or array (errorRefs) | yes |
40844094
| [transition](#Transitions) or [end](#End-Definition) | Transition to next state to handle the error, or end workflow execution if this error is encountered | object | yes |
40854095

40864096
<details><summary><strong>Click to view example definition</strong></summary>
@@ -4125,10 +4135,15 @@ Can be used when `errorRef` is not used. Usable when you want to define multiple
41254135
or end definition should be applied.For more info on workflow error handling
41264136
referece [this section](#Defining-Errors).
41274137

4138+
Note that the `errorRef` and `errorRefs` properties are mutually exclusive, meaning that you can only specify one or the other,
4139+
but not both at the same time.
4140+
41284141
The `transition` property defines the transition to the next workflow state in cases when the defined
41294142
error happens during runtime execution.
41304143

41314144
If `transition` is not defined you can also define the `end` property which will end workflow execution at that point.
4145+
Note that the `transition` and `end` properties are mutually exclusive, meaning that you can only specify one or the other,
4146+
but not both at the same time.
41324147

41334148
For more information, see the [Workflow Error Handling](#Workflow-Error-Handling) sections.
41344149

@@ -4377,7 +4392,8 @@ The `condition` property of the condition defines an expression (e.g., `${ .appl
43774392
parts of the state data input. The condition must evaluate to `true` or `false`.
43784393

43794394
If the condition is evaluated to `true`, you can specify either the `transition` or `end` definitions
4380-
to decide what to do, transition to another workflow state, or end workflow execution.
4395+
to decide what to do, transition to another workflow state, or end workflow execution. Note that `transition` and `end`
4396+
definitions are mutually exclusive, meaning that you can specify either one or the other, but not both.
43814397

43824398
##### Switch State Event Conditions
43834399

@@ -4432,6 +4448,9 @@ to decide what to do, transition to another workflow state, or end workflow exec
44324448

44334449
The `eventDataFilter` property can be used to filter event data when it is received.
44344450

4451+
Note that `transition` and `end`
4452+
definitions are mutually exclusive, meaning that you can specify either one or the other, but not both.
4453+
44354454
##### Parallel State Branch
44364455

44374456
| Parameter | Description | Type | Required |

0 commit comments

Comments
 (0)