Skip to content

Commit ddce579

Browse files
authored
v08 spec alignment - ForEach state iterationParam no longer a require… (#85)
* v08 spec alignment - ForEach state iterationParam no longer a required property Signed-off-by: spolti <filippespolti@gmail.com> * Update model/states.go Co-authored-by: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> Signed-off-by: spolti <filippespolti@gmail.com> Signed-off-by: spolti <filippespolti@gmail.com>
1 parent 3af7606 commit ddce579

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

go.sum

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUA
3737
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
3838
github.com/senseyeio/duration v0.0.0-20180430131211-7c2a214ada46 h1:Dz0HrI1AtNSGCE8LXLLqoZU4iuOJXPWndenCsZfstA8=
3939
github.com/senseyeio/duration v0.0.0-20180430131211-7c2a214ada46/go.mod h1:is8FVkzSi7PYLWEXT5MgWhglFsyyiW8ffxAoJqfuFZo=
40-
github.com/serverlessworkflow/sdk-go v1.0.0 h1:XsRtESODZhyvwHYgARH2VuubiZytME3jiJ61zwGj2YQ=
41-
github.com/serverlessworkflow/sdk-go v1.0.0/go.mod h1:y8Va8RTSHEGShsyISobSCKiniKiBKTUne73pY5sux0E=
4240
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
4341
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
4442
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
@@ -89,8 +87,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
8987
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
9088
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
9189
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
92-
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
93-
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
9490
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
9591
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
9692
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
@@ -103,6 +99,5 @@ k8s.io/klog/v2 v2.70.1 h1:7aaoSdahviPmR+XkS7FyxlkkXs6tHISSG03RxleQAVQ=
10399
k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
104100
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=
105101
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
106-
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
107102
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
108103
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=

model/states.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ type ForEachState struct {
237237
// Workflow expression specifying an array element of the states data to add the results of each iteration
238238
OutputCollection string `json:"outputCollection,omitempty"`
239239
// 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
240-
IterationParam string `json:"iterationParam" validate:"required"`
240+
IterationParam string `json:"iterationParam,omitempty"`
241241
// Specifies how upper bound on how many iterations may run in parallel
242242
BatchSize intstr.IntOrString `json:"batchSize,omitempty"`
243243
// Actions to be executed for each of the elements of inputCollection

parser/testdata/workflows/greetings-v08-spec.sw.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ functions:
2020
- name: greetingCustomFunction
2121
operation: /path/to/my/script/greeting.ts#CustomGreeting
2222
type: custom
23+
- name: sendTextFunction
24+
operation: http://myapis.org/inboxapi.json#sendText
2325

2426
states:
2527
- name: Greet
@@ -35,5 +37,13 @@ states:
3537
dataResultsPath: "${ .payload | .greeting }"
3638
stateDataFilter:
3739
dataOutputPath: "${ .greeting }"
38-
end:
39-
terminate: true
40+
transition: SendTextForHighPriority
41+
- name: SendTextForHighPriority
42+
type: foreach
43+
inputCollection: "${ .messages }"
44+
actions:
45+
- functionRef:
46+
refName: sendTextFunction
47+
arguments:
48+
message: "${ .singlemessage }"
49+
end: true

0 commit comments

Comments
 (0)