Skip to content

Commit 3424d38

Browse files
authored
Merge pull request #882 from matthias-pichler-warrify/matthias-pichler/remove-reliance-875
Remove reliance on key order in maps/objects
2 parents a25f33c + dfe3e67 commit 3424d38

22 files changed

+775
-747
lines changed

ctk/features/call.feature

+39-44
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ Feature: Call Task
1515
namespace: default
1616
name: http-call-with-content-output
1717
do:
18-
getFirstAvailablePet:
19-
call: http
20-
with:
21-
method: get
22-
endpoint:
23-
uri: https://petstore.swagger.io/v2/pet/findByStatus?status={status}
24-
output:
25-
from: .[0]
18+
call: http
19+
with:
20+
method: get
21+
endpoint:
22+
uri: https://petstore.swagger.io/v2/pet/findByStatus?status={status}
23+
output:
24+
from: .[0]
2625
"""
2726
And given the workflow input is:
2827
"""yaml
@@ -43,13 +42,12 @@ Feature: Call Task
4342
namespace: default
4443
name: http-call-with-response-output
4544
do:
46-
getPetById:
47-
call: http
48-
with:
49-
method: get
50-
endpoint:
51-
uri: https://petstore.swagger.io/v2/pet/{petId}
52-
output: response
45+
call: http
46+
with:
47+
method: get
48+
endpoint:
49+
uri: https://petstore.swagger.io/v2/pet/{petId}
50+
output: response
5351
"""
5452
And given the workflow input is:
5553
"""yaml
@@ -70,16 +68,15 @@ Feature: Call Task
7068
namespace: default
7169
name: http-call-with-basic-auth
7270
do:
73-
getSecuredEndpoint:
74-
call: http
75-
with:
76-
method: get
77-
endpoint:
78-
uri: https://httpbin.org/basic-auth/{username}/{password}
79-
authentication:
80-
basic:
81-
username: ${ .username }
82-
password: ${ .password }
71+
call: http
72+
with:
73+
method: get
74+
endpoint:
75+
uri: https://httpbin.org/basic-auth/{username}/{password}
76+
authentication:
77+
basic:
78+
username: ${ .username }
79+
password: ${ .password }
8380
"""
8481
And given the workflow input is:
8582
"""yaml
@@ -99,16 +96,15 @@ Feature: Call Task
9996
namespace: default
10097
name: openapi-call-with-content-output
10198
do:
102-
getPetsByStatus:
103-
call: openapi
104-
with:
105-
document:
106-
uri: https://petstore.swagger.io/v2/swagger.json
107-
operation: findPetsByStatus
108-
parameters:
109-
status: ${ .status }
110-
output:
111-
from: . | length
99+
call: openapi
100+
with:
101+
document:
102+
uri: https://petstore.swagger.io/v2/swagger.json
103+
operation: findPetsByStatus
104+
parameters:
105+
status: ${ .status }
106+
output:
107+
from: . | length
112108
"""
113109
And given the workflow input is:
114110
"""yaml
@@ -127,15 +123,14 @@ Feature: Call Task
127123
namespace: default
128124
name: openapi-call-with-response-output
129125
do:
130-
getPetById:
131-
call: openapi
132-
with:
133-
document:
134-
uri: https://petstore.swagger.io/v2/swagger.json
135-
operation: getPetById
136-
parameters:
137-
petId: ${ .petId }
138-
output: response
126+
call: openapi
127+
with:
128+
document:
129+
uri: https://petstore.swagger.io/v2/swagger.json
130+
operation: getPetById
131+
parameters:
132+
petId: ${ .petId }
133+
output: response
139134
"""
140135
And given the workflow input is:
141136
"""yaml

ctk/features/composite.feature

+11-13
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ Feature: Composite Task
1212
namespace: default
1313
name: composite-sequential
1414
do:
15-
setRGB:
16-
execute:
17-
sequentially:
18-
setRed:
15+
execute:
16+
sequentially:
17+
- setRed:
1918
set:
2019
colors: ${ .colors + ["red"] }
21-
setGreen:
20+
- setGreen:
2221
set:
2322
colors: ${ .colors + ["green"] }
24-
setBlue:
23+
- setBlue:
2524
set:
2625
colors: ${ .colors + ["blue"] }
2726
"""
@@ -40,19 +39,18 @@ Feature: Composite Task
4039
namespace: default
4140
name: composite-sequential
4241
do:
43-
setRGB:
44-
execute:
45-
concurrently:
46-
setRed:
42+
execute:
43+
compete: true
44+
concurrently:
45+
- setRed:
4746
set:
4847
colors: ${ .colors + ["red"] }
49-
setGreen:
48+
- setGreen:
5049
set:
5150
colors: ${ .colors + ["green"] }
52-
setBlue:
51+
- setBlue:
5352
set:
5453
colors: ${ .colors + ["blue"] }
55-
compete: true
5654
"""
5755
When the workflow is executed
5856
Then the workflow should complete

ctk/features/data-flow.feature

+29-29
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ Feature: Data Flow
1212
namespace: default
1313
name: output-filtering
1414
do:
15-
setUsername:
16-
input:
17-
from: .user.claims.subject #filters the input of the task, using only the user's subject
18-
set:
19-
playerId: ${ . }
15+
input:
16+
from: .user.claims.subject #filters the input of the task, using only the user's subject
17+
set:
18+
playerId: ${ . }
2019
"""
2120
And given the workflow input is:
2221
"""yaml
@@ -39,14 +38,13 @@ Feature: Data Flow
3938
namespace: default
4039
name: output-filtering
4140
do:
42-
getPetById:
43-
call: http
44-
with:
45-
method: get
46-
endpoint:
47-
uri: https://petstore.swagger.io/v2/pet/{petId} #simple interpolation, only possible with top level variables
48-
output:
49-
from: .id #filters the output of the http call, using only the id of the returned object
41+
call: http
42+
with:
43+
method: get
44+
endpoint:
45+
uri: https://petstore.swagger.io/v2/pet/{petId} #simple interpolation, only possible with top level variables
46+
output:
47+
from: .id #filters the output of the http call, using only the id of the returned object
5048
"""
5149
And given the workflow input is:
5250
"""yaml
@@ -67,22 +65,24 @@ Feature: Data Flow
6765
namespace: default
6866
name: non-object-output
6967
do:
70-
getPetById1:
71-
call: http
72-
with:
73-
method: get
74-
endpoint:
75-
uri: https://petstore.swagger.io/v2/pet/{petId} #simple interpolation, only possible with top level variables
76-
output:
77-
from: .id
78-
getPetById2:
79-
call: http
80-
with:
81-
method: get
82-
endpoint:
83-
uri: https://petstore.swagger.io/v2/pet/2
84-
output:
85-
from: '{ ids: [ $input, .id ] }'
68+
execute:
69+
sequentially:
70+
- getPetById1:
71+
call: http
72+
with:
73+
method: get
74+
endpoint:
75+
uri: https://petstore.swagger.io/v2/pet/{petId} #simple interpolation, only possible with top level variables
76+
output:
77+
from: .id
78+
- getPetById2:
79+
call: http
80+
with:
81+
method: get
82+
endpoint:
83+
uri: https://petstore.swagger.io/v2/pet/2
84+
output:
85+
from: '{ ids: [ $input, .id ] }'
8686
"""
8787
When the workflow is executed
8888
Then the workflow should complete with output:

ctk/features/emit.feature

+7-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ Feature: Emit Task
1212
namespace: default
1313
name: emit
1414
do:
15-
emitUserGreeted:
16-
emit:
17-
event:
18-
with:
19-
source: https://fake-source.com
20-
type: com.fake-source.user.greeted.v1
21-
data:
22-
greetings: ${ "Hello \(.user.firstName) \(.user.lastName)!" }
15+
emit:
16+
event:
17+
with:
18+
source: https://fake-source.com
19+
type: com.fake-source.user.greeted.v1
20+
data:
21+
greetings: ${ "Hello \(.user.firstName) \(.user.lastName)!" }
2322
"""
2423
And given the workflow input is:
2524
"""yaml

ctk/features/flow.feature

+25-21
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ Feature: Flow Directive
1111
namespace: default
1212
name: implicit-sequence
1313
do:
14-
setRed:
15-
set:
16-
colors: '${ .colors + [ "red" ] }'
17-
setGreen:
18-
set:
19-
colors: '${ .colors + [ "green" ] }'
20-
setBlue:
21-
set:
22-
colors: '${ .colors + [ "blue" ] }'
14+
execute:
15+
sequentially:
16+
- setRed:
17+
set:
18+
colors: '${ .colors + [ "red" ] }'
19+
- setGreen:
20+
set:
21+
colors: '${ .colors + [ "green" ] }'
22+
- setBlue:
23+
set:
24+
colors: '${ .colors + [ "blue" ] }'
2325
"""
2426
When the workflow is executed
2527
Then the workflow should complete with output:
@@ -38,18 +40,20 @@ Feature: Flow Directive
3840
namespace: default
3941
name: explicit-sequence
4042
do:
41-
setRed:
42-
set:
43-
colors: '${ .colors + [ "red" ] }'
44-
then: setGreen
45-
setBlue:
46-
set:
47-
colors: '${ .colors + [ "blue" ] }'
48-
then: end
49-
setGreen:
50-
set:
51-
colors: '${ .colors + [ "green" ] }'
52-
then: setBlue
43+
execute:
44+
sequentially:
45+
- setRed:
46+
set:
47+
colors: '${ .colors + [ "red" ] }'
48+
then: setGreen
49+
- setBlue:
50+
set:
51+
colors: '${ .colors + [ "blue" ] }'
52+
then: end
53+
- setGreen:
54+
set:
55+
colors: '${ .colors + [ "green" ] }'
56+
then: setBlue
5357
"""
5458
When the workflow is executed
5559
Then the workflow should complete with output:

ctk/features/for.feature

+6-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ Feature: For Task
1414
namespace: default
1515
name: for
1616
do:
17-
forEachColor:
18-
for:
19-
each: color
20-
in: '.colors'
21-
do:
22-
set:
23-
processed: '${ { colors: (.processed.colors + [ $color ]), indexes: (.processed.indexes + [ $index ])} }'
17+
for:
18+
each: color
19+
in: '.colors'
20+
do:
21+
set:
22+
processed: '${ { colors: (.processed.colors + [ $color ]), indexes: (.processed.indexes + [ $index ])} }'
2423
"""
2524
And given the workflow input is:
2625
"""yaml

ctk/features/raise.feature

+5-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ Feature: Raise Task
1111
namespace: default
1212
name: raise-custom-error
1313
do:
14-
raiseComplianceError:
15-
raise:
16-
error:
17-
status: 400
18-
type: https://serverlessworkflow.io/errors/types/compliance
19-
title: Compliance Error
14+
raise:
15+
error:
16+
status: 400
17+
type: https://serverlessworkflow.io/errors/types/compliance
18+
title: Compliance Error
2019
"""
2120
When the workflow is executed
2221
Then the workflow should fault with error:

ctk/features/set.feature

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ Feature: Set Task
1212
namespace: default
1313
name: set
1414
do:
15-
initialize:
16-
set:
17-
shape: circle
18-
size: ${ .configuration.size }
19-
fill: ${ .configuration.fill }
15+
set:
16+
shape: circle
17+
size: ${ .configuration.size }
18+
fill: ${ .configuration.fill }
2019
"""
2120
And given the workflow input is:
2221
"""yaml

0 commit comments

Comments
 (0)