File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ type Action struct {
37
37
RetryableErrors []string `json:"retryableErrors,omitempty" validate:"omitempty,min=1"`
38
38
// Action data filter
39
39
ActionDataFilter ActionDataFilter `json:"actionDataFilter,omitempty"`
40
+ // Workflow expression evaluated against state data. Must evaluate to true or false
41
+ Condition string `json:"condition,omitempty"`
40
42
}
41
43
42
44
// FunctionRef ...
Original file line number Diff line number Diff line change @@ -82,6 +82,10 @@ func TestFromFile(t *testing.T) {
82
82
assert .IsType (t , & model.DataBasedSwitchState {}, w .States [0 ])
83
83
assert .IsType (t , & model.EventBasedSwitchState {}, w .States [1 ])
84
84
},
85
+ "./testdata/workflows/conditionbasedstate.yaml" : func (t * testing.T , w * model.Workflow ) {
86
+ operationState := w .States [0 ].(* model.OperationState )
87
+ assert .Equal (t , "${ .applicants | .age < 18 }" , operationState .Actions [0 ].Condition )
88
+ },
85
89
"./testdata/workflows/eventbasedgreeting.sw.json" : func (t * testing.T , w * model.Workflow ) {
86
90
assert .Equal (t , "GreetingEvent" , w .Events [0 ].Name )
87
91
assert .IsType (t , & model.EventState {}, w .States [0 ])
Original file line number Diff line number Diff line change
1
+ # Copyright 2020 The Serverless Workflow Specification Authors
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ id : greeting
16
+ version : ' 1.0'
17
+ name : Greeting Workflow
18
+ description : Greet Someone
19
+ specVersion : " 0.8"
20
+ start :
21
+ stateName : Greet
22
+ functions :
23
+ - name : greetingFunction
24
+ operation : file://myapis/greetingapis.json#greeting
25
+ states :
26
+ - name : Greet
27
+ type : operation
28
+ actionMode : sequential
29
+ actions :
30
+ - functionRef :
31
+ refName : greetingFunction
32
+ parameters :
33
+ name : " ${ .greet | .name }"
34
+ actionDataFilter :
35
+ toStateData : " ${ .payload | .greeting }"
36
+ condition : " ${ .applicants | .age < 18 }"
37
+ stateDataFilter :
38
+ dataOutputPath : " ${ .greeting }"
39
+ end :
40
+ terminate : true
You can’t perform that action at this time.
0 commit comments