Skip to content

Commit 729c937

Browse files
author
Tihomir Surdilovic
committed
Update to switch state conditions and default param
Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent 0f5e220 commit 729c937

File tree

12 files changed

+64
-13
lines changed

12 files changed

+64
-13
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"type": "object",
3+
"javaType": "io.serverlessworkflow.api.defaultdef.DefaultDefinition",
4+
"description": "Switch state default definition",
5+
"properties": {
6+
"transition": {
7+
"$ref": "../transitions/transition.json",
8+
"description": "Next transition of the workflow if there is valid matches"
9+
},
10+
"end": {
11+
"$ref": "../end/end.json",
12+
"description": "Explicit transition to end"
13+
}
14+
},
15+
"oneOf": [
16+
{
17+
"required": [
18+
"transition"
19+
]
20+
},
21+
{
22+
"required": [
23+
"end"
24+
]
25+
}
26+
]
27+
}

api/src/main/resources/schema/states/switchstate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"description": "If eventConditions is used, defines the time period to wait for events (ISO 8601 format)"
3131
},
3232
"default": {
33-
"$ref": "../transitions/transition.json"
33+
"$ref": "../default/defaultdef.json"
3434
}
3535
},
3636
"required": [

api/src/main/resources/schema/switchconditions/datacondition.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"transition": {
1414
"$ref": "../transitions/transition.json",
1515
"description": "Next transition of the workflow if there is valid matches"
16+
},
17+
"end": {
18+
"$ref": "../end/end.json",
19+
"description": "Explicit transition to end"
1620
}
1721
},
1822
"required": [

api/src/main/resources/schema/switchconditions/eventcondition.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
"transition": {
1616
"$ref": "../transitions/transition.json",
1717
"description": "Next transition of the workflow if there is valid matches"
18+
},
19+
"end": {
20+
"$ref": "../end/end.json",
21+
"description": "Explicit transition to end"
1822
}
1923
},
2024
"required": [

api/src/test/resources/examples/applicantrequest.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
}
3232
],
3333
"default": {
34-
"nextState": "RejectApplication"
34+
"transition": {
35+
"nextState": "RejectApplication"
36+
}
3537
}
3638
},
3739
{

api/src/test/resources/examples/applicantrequest.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
id: applicantrequest
23
version: '1.0'
34
name: Applicant Request Decision Workflow
@@ -18,7 +19,8 @@ states:
1819
transition:
1920
nextState: RejectApplication
2021
default:
21-
nextState: RejectApplication
22+
transition:
23+
nextState: RejectApplication
2224
- name: StartApplication
2325
type: subflow
2426
workflowId: startApplicationWorkflowId
@@ -33,4 +35,4 @@ states:
3335
parameters:
3436
applicant: "{{ $.applicant }}"
3537
end:
36-
kind: default
38+
kind: default

api/src/test/resources/examples/creditcheck.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@
6565
}
6666
],
6767
"default": {
68-
"nextState": "RejectApplication"
68+
"transition": {
69+
"nextState": "RejectApplication"
70+
}
6971
}
7072
},
7173
{

api/src/test/resources/examples/creditcheck.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
id: customercreditcheck
23
version: '1.0'
34
name: Customer Credit Check Workflow
@@ -38,7 +39,8 @@ states:
3839
transition:
3940
nextState: RejectApplication
4041
default:
41-
nextState: RejectApplication
42+
transition:
43+
nextState: RejectApplication
4244
- name: StartApplication
4345
type: subflow
4446
workflowId: startApplicationWorkflowId
@@ -53,4 +55,4 @@ states:
5355
parameters:
5456
applicant: "{{ $.customer }}"
5557
end:
56-
kind: default
58+
kind: default

api/src/test/resources/examples/eventbasedtransition.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
],
3939
"eventTimeout": "PT1H",
4040
"default": {
41-
"nextState": "HandleNoVisaDecision"
41+
"transition": {
42+
"nextState": "HandleNoVisaDecision"
43+
}
4244
}
4345
},
4446
{

api/src/test/resources/examples/eventbasedtransition.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
id: eventbasedswitch
23
version: '1.0'
34
name: Event Based Switch Transitions
@@ -23,7 +24,8 @@ states:
2324
nextState: HandleRejectedVisa
2425
eventTimeout: PT1H
2526
default:
26-
nextState: HandleNoVisaDecision
27+
transition:
28+
nextState: HandleNoVisaDecision
2729
- name: HandleApprovedVisa
2830
type: subflow
2931
workflowId: handleApprovedVisaWorkflowID
@@ -38,4 +40,4 @@ states:
3840
type: subflow
3941
workflowId: handleNoVisaDecisionWorkfowId
4042
end:
41-
kind: default
43+
kind: default

0 commit comments

Comments
 (0)