Skip to content

Commit d3fc741

Browse files
authored
Add useResults and useData to action and event data filters (#499)
* Add useResults and useData to action and event data filters Signed-off-by: Tihomir Surdilovic <[email protected]> * fix spec doc value Signed-off-by: Tihomir Surdilovic <[email protected]> * added little more description Signed-off-by: Tihomir Surdilovic <[email protected]> * fix parenthesis Signed-off-by: Tihomir Surdilovic <[email protected]> * update to roadmap Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent c59921d commit d3fc741

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

roadmap/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ _Status description:_
2424
| --- | --- | --- |
2525
| ✔️| Support custom function `type` definition | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
2626
| ✔️| Workflow "name" no longer a required property | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
27-
| ✔️| Workflow "start" no longer a required property| [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
28-
| ✔️| ForEach state "iterationParam" no longer a required property| [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
27+
| ✔️| Workflow "start" no longer a required property | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
28+
| ✔️| ForEach state "iterationParam" no longer a required property | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
29+
| ✔️| Added "useData" for eventDataFilter, and "useResults" for actionDataFilter | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) |
2930
| ✏️️| Support for async action invocation | |
3031
| ✏️️| Add "completedBy" functionality | |
3132
| ✏️️| Define workflow context | |

schema/workflow.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1911,9 +1911,14 @@
19111911
"eventdatafilter": {
19121912
"type": "object",
19131913
"properties": {
1914+
"useData": {
1915+
"type": "boolean",
1916+
"description": "If set to false, event payload is not added/merged to state data. In this case 'data' and 'toStateData' should be ignored. Default is true.",
1917+
"default": true
1918+
},
19141919
"data": {
19151920
"type": "string",
1916-
"description": "Workflow expression that filters the received event/payload (default: '${ . }')"
1921+
"description": "Workflow expression that filters the received event payload (default: '${ . }')"
19171922
},
19181923
"toStateData": {
19191924
"type": "string",
@@ -1930,6 +1935,11 @@
19301935
"type": "string",
19311936
"description": "Workflow expression that selects state data that the state action can use"
19321937
},
1938+
"useResults": {
1939+
"type": "boolean",
1940+
"description": "If set to false, action data results are not added/merged to state data. In this case 'results' and 'toStateData' should be ignored. Default is true.",
1941+
"default": true
1942+
},
19331943
"results": {
19341944
"type": "string",
19351945
"description": "Workflow expression that filters the actions data results"

specification.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ The second way would be to directly filter only the "veggie like" vegetables wit
429429
| Parameter | Description | Type | Required |
430430
| --- | --- | --- | --- |
431431
| fromStateData | Workflow expression that filters state data that can be used by the action | string | no |
432+
| useResults | If set to false, action data results are not added/merged to state data. In this case 'results' and 'toStateData' should be ignored. Default is true. | boolean | no |
432433
| results | Workflow expression that filters the actions data results | string | no |
433434
| toStateData | Workflow expression that selects a state data element to which the action results should be added/merged into. If not specified denotes the top-level state data element | string | no |
434435

@@ -555,10 +556,15 @@ into. With this, after our action executes the state data would be:
555556
}
556557
```
557558

559+
In the case action results should not be added/merged to state data, we can set the `useResults` property to `false`.
560+
In this case, the `results` and `toStateData` properties should be ignored, and nothing is added/merged to state data.
561+
If `useResults` is not specified (or it's value set to `true`), action results, if available, should be added/merged to state data.
562+
558563
#### Event data filters
559564

560565
| Parameter | Description | Type | Required |
561566
| --- | --- | --- | --- |
567+
| useData | If set to false, event payload is not added/merged to state data. In this case 'data' and 'toStateData' should be ignored. Default is true. | boolean | no |
562568
| data | Workflow expression that filters the event data (payload) | string | no |
563569
| toStateData | Workflow expression that selects a state data element to which the action results should be added/merged into. If not specified denotes the top-level state data element | string | no |
564570

@@ -616,6 +622,11 @@ Note that the data input to the Event data filters depends on the `dataOnly` pro
616622
If this property is not defined (has default value of `true`), Event data filter expressions are evaluated against the event payload (the CloudEvents `data` attribute only). If it is set to
617623
`false`, the expressions should be evaluated against the entire CloudEvent (including its context attributes).
618624

625+
In the case event data/payload should not be added/merged to state data, we can set the `useData` property to `false`.
626+
In this case, the `data` and `toStateData` properties should be ignored, and nothing is added/merged to state data.
627+
If `useData` is not specified (or it's value set to `true`), event payload, if available, should be added/merged to state data.
628+
629+
619630
#### Using multiple data filters
620631

621632
As [Event states](#Event-State) can take advantage of all defined data filters. In the example below, we define

0 commit comments

Comments
 (0)