From bbf6c27e975d7c5dbcb78e66fca03c0cebcebd61 Mon Sep 17 00:00:00 2001 From: manick02 Date: Fri, 10 Sep 2021 17:39:13 +0530 Subject: [PATCH 1/2] #462 Make IterationParam in foreach state optional Signed-off-by: cb-manick <80755357+cb-manick@users.noreply.github.com> --- schema/workflow.json | 3 --- specification.md | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/schema/workflow.json b/schema/workflow.json index b4b7df69..4094c7e2 100644 --- a/schema/workflow.json +++ b/schema/workflow.json @@ -1608,7 +1608,6 @@ "name", "type", "inputCollection", - "iterationParam", "actions" ] }, @@ -1619,7 +1618,6 @@ "name", "type", "inputCollection", - "iterationParam", "actions", "end" ] @@ -1629,7 +1627,6 @@ "name", "type", "inputCollection", - "iterationParam", "actions", "transition" ] diff --git a/specification.md b/specification.md index c4689ebb..0bfa0a79 100644 --- a/specification.md +++ b/specification.md @@ -2854,7 +2854,7 @@ The `timeouts` property can be used to define state specific timeout settings. I | type | State type | string | yes | | inputCollection | Workflow expression selecting an array element of the states data | string | yes | | outputCollection | Workflow expression specifying an array element of the states data to add the results of each iteration | string | no | -| iterationParam | Name of the iteration parameter that can be referenced in actions/workflow. For each parallel iteration, this param should contain an unique element of the inputCollection array | string | yes | +| iterationParam | Name of the iteration parameter that can be referenced in actions/workflow. For each parallel iteration, this param should contain an unique element of the inputCollection array | string | no | | batchSize | Specifies how many iterations may run in parallel at the same time. Used if `mode` property is set to `parallel` (default). If not specified, its value should be the size of the `inputCollection` | string or number | no | | mode | Specifies how iterations are to be performed (sequentially or in parallel). Default is `parallel` | string | no | | [actions](#Action-Definition) | Actions to be executed for each of the elements of inputCollection | array | yes | From e6ddfe2ae4ba3b15c6944e4f7fd8a41baf45e8b2 Mon Sep 17 00:00:00 2001 From: Tihomir Surdilovic Date: Sat, 11 Sep 2021 19:08:03 -0400 Subject: [PATCH 2/2] updated text on spec doc and added to roadmap Signed-off-by: Tihomir Surdilovic --- roadmap/README.md | 5 +++-- specification.md | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/roadmap/README.md b/roadmap/README.md index 15c6ca9b..8bdc72ff 100644 --- a/roadmap/README.md +++ b/roadmap/README.md @@ -23,8 +23,9 @@ _Status description:_ | Status | Description | Comments | | --- | --- | --- | | ✔️| Support custom function `type` definition | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) | -| ✔️| Workflow "name" no longer a required parameter | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) | -| ✔️| Workflow "start" no longer a required parameter| [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) | +| ✔️| Workflow "name" no longer a required property | [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) | +| ✔️| Workflow "start" no longer a required property| [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) | +| ✔️| ForEach state "iterationParam" no longer a required property| [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md) | | ✏️️| Support for async action invocation | | | ✏️️| Start work on TCK | | | ✏️️| Add more samples | | diff --git a/specification.md b/specification.md index 0bfa0a79..f288f62d 100644 --- a/specification.md +++ b/specification.md @@ -2926,8 +2926,8 @@ Each iteration of the ForEach state is by default executed in parallel by defaul However, executing iterations sequentially is also possible by setting the value of the `mode` property to `sequential`. -The `mode` property defines if iterations should be done sequentially or in parallel. By default -(if `mode` is not specified) iterations should be done in parallel. +The `mode` property defines if iterations should be done sequentially or in parallel. By default, +if `mode` is not specified, iterations should be done in parallel. If the default `parallel` iteration mode is used, the `batchSize` property to the number of iterations (batch) that can be executed at a time. To give an example, if the number of iterations is 55 and `batchSize` @@ -2942,9 +2942,10 @@ an error. This error can be handled inside the states [`onErrors`](#Error-Defini The `outputCollection` property is a workflow expression which selects an array in the state data where the results of each iteration should be added to. If this array does not exist, it should be created. -The `iterationParam` property defines the name of the iteration parameter passed to each parallel execution of the ForEach state. -It should contain the unique element of the `inputCollection` array and passed as data input to the actions/workflow defined. -`iterationParam` should be created for each iteration, so it can be referenced/used in defined actions / workflow data input. +The `iterationParam` property defines the name of the iteration parameter passed to each iteration of the ForEach state. +It should contain the unique element of the `inputCollection` array and made available to actions of the ForEach state. +If `iterationParam` is not explicitly defined, runtimes should create one and populate it with the value of the unique +iteration parameter for each iteration of the ForEach state. The `actions` property defines actions to be executed in each state iteration.