Skip to content

Commit 6367a2e

Browse files
Merge pull request #683 from fjtirado/forach_iteration_param
ForEach iteration param access
2 parents f542e91 + 9d49735 commit 6367a2e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

roadmap/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ _Status description:_
3535
| ✔️| Apply fixes to auth spec schema [workflow schema](https://github.com/serverlessworkflow/specification/tree/main/schema) |
3636
| ✔️| Update the `dataInputSchema` top-level property by supporting the assignment of a JSON schema object [workflow schema](https://github.com/serverlessworkflow/specification/tree/main/specification.md#workflow-definition-structure) |
3737
| ✔️| Add the new `WORKFLOW` reserved keyword to workflow expressions |
38+
| ✔️| Update `ForEach` state iteration parameter example. This parameter is an expression variable, not a JSON property |
3839
| ✏️️| Add inline state defs in branches | |
3940
| ✏️️| Update rest function definition | |
4041
| ✏️️| Add "completedBy" functionality | |

specification.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,7 +2884,7 @@ Note that `transition` and `end` properties are mutually exclusive, meaning that
28842884
"functionRef": {
28852885
"refName": "provisionOrderFunction",
28862886
"arguments": {
2887-
"order": "${ .singleorder }"
2887+
"order": "${ $singleorder }"
28882888
}
28892889
}
28902890
}
@@ -2905,7 +2905,7 @@ actions:
29052905
- functionRef:
29062906
refName: provisionOrderFunction
29072907
arguments:
2908-
order: "${ .singleorder }"
2908+
order: "${ $singleorder }"
29092909
```
29102910

29112911
</td>
@@ -2938,6 +2938,7 @@ of each iteration should be added to. If this array does not exist, it should be
29382938

29392939
The `iterationParam` property defines the name of the iteration parameter passed to each iteration of the ForEach state.
29402940
It should contain the unique element of the `inputCollection` array and made available to actions of the ForEach state.
2941+
`iterationParam` can be accessed as an expression variable. [In JQ, expression variables are prefixed by $](https://stedolan.github.io/jq/manual/#Variable/SymbolicBindingOperator:...as$identifier|...).
29412942
If `iterationParam` is not explicitly defined, runtimes should create one and populate it with the value of the unique
29422943
iteration parameter for each iteration of the ForEach state.
29432944

@@ -3004,8 +3005,8 @@ and our workflow is defined as:
30043005
"functionRef": {
30053006
"refName": "sendConfirmationFunction",
30063007
"arguments": {
3007-
"orderNumber": "${ .completedorder.orderNumber }",
3008-
"email": "${ .completedorder.email }"
3008+
"orderNumber": "${ $completedorder.orderNumber }",
3009+
"email": "${ $completedorder.email }"
30093010
}
30103011
}
30113012
}],
@@ -3036,8 +3037,8 @@ states:
30363037
- functionRef:
30373038
refName: sendConfirmationFunction
30383039
arguments:
3039-
orderNumber: "${ .completedorder.orderNumber }"
3040-
email: "${ .completedorder.email }"
3040+
orderNumber: "${ $completedorder.orderNumber }"
3041+
email: "${ $completedorder.email }"
30413042
end: true
30423043
```
30433044

0 commit comments

Comments
 (0)