Skip to content

Commit 90bb6b2

Browse files
authored
Merge pull request #151 from tsurdilo/actioncondition
adding condition to actions
2 parents df1154c + 6365cc8 commit 90bb6b2

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

api/src/main/resources/schema/actions/action.json

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
},
4949
"actionDataFilter": {
5050
"$ref": "../filters/actiondatafilter.json"
51+
},
52+
"condition": {
53+
"description": "Expression, if defined, must evaluate to true for this action to be performed. If false, action is disregarded",
54+
"type": "string",
55+
"minLength": 1
5156
}
5257
},
5358
"oneOf": [

api/src/test/java/io/serverlessworkflow/api/test/MarkupToWorkflowTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,8 @@ public void testErrorsParams(String workflowLocation) {
747747
assertEquals("testRetry", actions.get(0).getRetryRef());
748748
assertNotNull(actions.get(0).getNonRetryableErrors());
749749
assertEquals(2, actions.get(0).getNonRetryableErrors().size());
750+
assertNotNull(actions.get(0).getCondition());
751+
assertEquals("${ .data }", actions.get(0).getCondition());
750752

751753
assertNotNull(operationState.getOnErrors());
752754
assertEquals(1, operationState.getOnErrors().size());

api/src/test/resources/features/errors.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
{
2424
"functionRef": "addPet",
2525
"retryRef": "testRetry",
26-
"nonRetryableErrors": ["A", "B"]
26+
"nonRetryableErrors": ["A", "B"],
27+
"condition": "${ .data }"
2728
}
2829
],
2930
"onErrors": [

api/src/test/resources/features/errors.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ states:
1818
nonRetryableErrors:
1919
- A
2020
- B
21+
condition: "${ .data }"
2122
onErrors:
2223
- errorRefs:
2324
- A

0 commit comments

Comments
 (0)