Skip to content

Commit e7217c5

Browse files
committed
[Fix serverlessworkflow#359] Deserialization
1 parent 317d04a commit e7217c5

File tree

12 files changed

+177
-213
lines changed

12 files changed

+177
-213
lines changed
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
document:
22
dsl: 1.0.0-alpha1
33
namespace: default
4-
name: http-call-with-content-output
4+
name: http-call-with-response-output
55
do:
6-
getFirstAvailablePet:
7-
call: http
8-
with:
9-
method: get
10-
endpoint:
11-
uri: https://petstore.swagger.io/v2/pet/findByStatus?status={status}
12-
output:
13-
from: .[0]
6+
- getPet:
7+
call: http
8+
with:
9+
method: get
10+
endpoint:
11+
uri: https://petstore.swagger.io/v2/pet/{petId}
12+
output: response

api/src/test/resources/features/callOpenAPI.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ document:
33
namespace: default
44
name: openapi-call-with-content-output
55
do:
6-
getPetsByStatus:
7-
call: openapi
8-
with:
9-
document:
10-
uri: https://petstore.swagger.io/v2/swagger.json
11-
operation: findPetsByStatus
12-
parameters:
13-
status: ${ .status }
14-
output:
15-
from: . | length
6+
- findPet:
7+
call: openapi
8+
with:
9+
document:
10+
uri: "https://petstore.swagger.io/v2/swagger.json"
11+
operation: findPetsByStatus
12+
parameters:
13+
status: ${ .status }
14+
output:
15+
from: . | length
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
document:
2-
dsl: 1.0.0-alpha1
3-
namespace: default
4-
name: composite-sequential
2+
dsl: 1.0.0-alpha1
3+
namespace: default
4+
name: do
55
do:
6-
setRGB:
7-
execute:
8-
sequentially:
9-
setRed:
10-
set:
11-
colors: ${ .colors + ["red"] }
12-
setGreen:
13-
set:
14-
colors: ${ .colors + ["green"] }
15-
setBlue:
16-
set:
17-
colors: ${ .colors + ["blue"] }
6+
- compositeExample:
7+
do:
8+
- setRed:
9+
set:
10+
colors: ${ .colors + ["red"] }
11+
- setGreen:
12+
set:
13+
colors: ${ .colors + ["green"] }
14+
- setBlue:
15+
set:
16+
colors: ${ .colors + ["blue"] }
Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
document:
22
dsl: 1.0.0-alpha1
33
namespace: default
4-
name: non-object-output
4+
name: output-filtering
55
do:
6-
getPetById1:
7-
call: http
8-
with:
9-
method: get
10-
endpoint:
11-
uri: https://petstore.swagger.io/v2/pet/{petId} #simple interpolation, only possible with top level variables
12-
output:
13-
from: .id
14-
getPetById2:
15-
call: http
16-
with:
17-
method: get
18-
endpoint:
19-
uri: https://petstore.swagger.io/v2/pet/2
20-
output:
21-
from: '{ ids: [ $input, .id ] }'
6+
- getPet:
7+
call: http
8+
with:
9+
method: get
10+
endpoint:
11+
uri: https://petstore.swagger.io/v2/pet/{petId} #simple interpolation, only possible with top level variables
12+
output:
13+
as: .id #filters the output of the http call, using only the id of the returned object
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
document:
2-
dsl: 1.0.0-alpha1
3-
namespace: default
4-
name: emit
2+
dsl: 1.0.0-alpha1
3+
namespace: default
4+
name: emit
55
do:
6-
emitUserGreeted:
7-
emit:
8-
event:
9-
with:
10-
source: https://fake-source.com
11-
type: com.fake-source.user.greeted.v1
12-
data:
13-
greetings: ${ "Hello \(.user.firstName) \(.user.lastName)!" }
6+
- emitEvent:
7+
emit:
8+
event:
9+
with:
10+
source: https://fake-source.com
11+
type: com.fake-source.user.greeted.v1
12+
data:
13+
greetings: ${ "Hello \(.user.firstName) \(.user.lastName)!" }
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
document:
2-
dsl: 1.0.0-alpha1
3-
namespace: default
4-
name: implicit-sequence
2+
dsl: 1.0.0-alpha1
3+
namespace: default
4+
name: implicit-sequence
55
do:
6-
setRed:
7-
set:
8-
colors: '${ .colors + [ "red" ] }'
9-
setGreen:
10-
set:
11-
colors: '${ .colors + [ "green" ] }'
12-
setBlue:
13-
set:
14-
colors: '${ .colors + [ "blue" ] }'
6+
- setRed:
7+
set:
8+
colors: '${ .colors + [ "red" ] }'
9+
- setGreen:
10+
set:
11+
colors: '${ .colors + [ "green" ] }'
12+
- setBlue:
13+
set:
14+
colors: '${ .colors + [ "blue" ] }'
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
document:
2-
dsl: 1.0.0-alpha1
3-
namespace: default
4-
name: for
2+
dsl: 1.0.0-alpha1
3+
namespace: default
4+
name: for
55
do:
6-
forEachColor:
7-
for:
8-
each: color
9-
in: '.colors'
10-
do:
11-
set:
12-
processed: '${ { colors: (.processed.colors + [ $color ]), indexes: (.processed.indexes + [ $index ])} }'
6+
- loopColors:
7+
for:
8+
each: color
9+
in: '.colors'
10+
do:
11+
- markProcessed:
12+
set:
13+
processed: '${ { colors: (.processed.colors + [ $color ]), indexes: (.processed.indexes + [ $index ])} }'
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
document:
2-
dsl: 1.0.0-alpha1
3-
namespace: default
4-
name: raise-custom-error
2+
dsl: 1.0.0-alpha1
3+
namespace: default
4+
name: raise-custom-error
55
do:
6-
raiseComplianceError:
7-
raise:
8-
error:
9-
status: 400
10-
type: https://serverlessworkflow.io/errors/types/compliance
11-
title: Compliance Error
6+
- raiseError:
7+
raise:
8+
error:
9+
status: 400
10+
type: https://serverlessworkflow.io/errors/types/compliance
11+
title: Compliance Error
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
document:
2-
dsl: 1.0.0-alpha1
3-
namespace: default
4-
name: set
2+
dsl: 1.0.0-alpha1
3+
namespace: default
4+
name: set
55
do:
6-
initialize:
7-
set:
8-
shape: circle
9-
size: ${ .configuration.size }
10-
fill: ${ .configuration.fill }
6+
- setShape:
7+
set:
8+
shape: circle
9+
size: ${ .configuration.size }
10+
fill: ${ .configuration.fill }
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
document:
2-
dsl: 1.0.0-alpha1
3-
namespace: default
4-
name: switch-match
2+
dsl: 1.0.0-alpha1
3+
namespace: default
4+
name: switch-match
55
do:
6-
switchColor:
7-
switch:
8-
red:
9-
when: '.color == "red"'
10-
then: setRed
11-
green:
12-
when: '.color == "green"'
13-
then: setGreen
14-
blue:
15-
when: '.color == "blue"'
16-
then: setBlue
17-
setRed:
18-
set:
19-
colors: '${ .colors + [ "red" ] }'
20-
then: end
21-
setGreen:
22-
set:
23-
colors: '${ .colors + [ "green" ] }'
24-
then: end
25-
setBlue:
26-
set:
27-
colors: '${ .colors + [ "blue" ] }'
28-
then: end
6+
- switchColor:
7+
switch:
8+
- red:
9+
when: '.color == "red"'
10+
then: setRed
11+
- green:
12+
when: '.color == "green"'
13+
then: setGreen
14+
- blue:
15+
when: '.color == "blue"'
16+
then: setBlue
17+
- setRed:
18+
set:
19+
colors: '${ .colors + [ "red" ] }'
20+
then: end
21+
- setGreen:
22+
set:
23+
colors: '${ .colors + [ "green" ] }'
24+
then: end
25+
- setBlue:
26+
set:
27+
colors: '${ .colors + [ "blue" ] }'
28+
then: end
Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
document:
2-
dsl: 1.0.0-alpha1
3-
namespace: default
4-
name: try-catch-404
2+
dsl: 1.0.0-alpha1
3+
namespace: default
4+
name: try-catch-404
55
do:
6-
tryGetPet:
7-
try:
8-
call: http
9-
with:
10-
method: get
11-
endpoint:
12-
uri: https://petstore.swagger.io/v2/pet/getPetByName/{petName}
13-
catch:
14-
errors:
15-
with:
16-
type: https://serverlessworkflow.io/dsl/errors/types/communication
17-
status: 404
18-
as: err
19-
do:
20-
set:
21-
error: ${ $err }
6+
- tryGetPet:
7+
try:
8+
- getPet:
9+
call: http
10+
with:
11+
method: get
12+
endpoint:
13+
uri: https://petstore.swagger.io/v2/pet/getPetByName/{petName}
14+
catch:
15+
errors:
16+
with:
17+
type: https://serverlessworkflow.io/dsl/errors/types/communication
18+
status: 404
19+
as: err
20+
do:
21+
- setError:
22+
set:
23+
error: ${ $err }

0 commit comments

Comments
 (0)