Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reliance on key order in maps/objects #882

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0776820
feat: update schema to have task array
matthias-pichler Jun 3, 2024
e9f6a66
fix: update examples to follow schema
matthias-pichler Jun 3, 2024
12d1c85
fix: make all tasks array entries
matthias-pichler Jun 3, 2024
96fa290
make: all task references arrays
matthias-pichler Jun 3, 2024
616f8f8
docs: update samples in docs
matthias-pichler Jun 3, 2024
0cfa468
docs: update dsl reference
matthias-pichler Jun 3, 2024
805addf
Fix #878 - Fix URI format in workflow schema for endpoint attribute
ricardozanini Jun 3, 2024
a38d4ce
Add missing example to verify change
ricardozanini Jun 3, 2024
03a8a6f
fix: update new example
matthias-pichler Jun 3, 2024
f7c0a34
fix: remove trailing colon
matthias-pichler Jun 3, 2024
de0efa2
fix: make extensions an array as well
matthias-pichler Jun 3, 2024
88bb6e4
fix: use endpoint instead of uri
matthias-pichler Jun 3, 2024
2864941
fix: use correct extend
matthias-pichler Jun 3, 2024
872edd3
fix: use endpoint object
matthias-pichler Jun 3, 2024
ad8bad8
refactor: only make do an array
matthias-pichler Jun 3, 2024
14c8783
fix: use const for call tasks
matthias-pichler Jun 3, 2024
226cf99
fix: replace ref with $ref
matthias-pichler Jun 3, 2024
4f21c9d
fix: allow references to authentications in use
matthias-pichler Jun 3, 2024
4b8e57a
fix: add missing type directives to tasks
matthias-pichler Jun 3, 2024
039b901
docs: add example of reusable auth
matthias-pichler Jun 3, 2024
58bd84a
docs: add async api example
matthias-pichler Jun 3, 2024
2f3d915
fix: use operationRef
matthias-pichler Jun 3, 2024
35c0e34
fix: update examples to new schema
matthias-pichler Jun 3, 2024
5e05b53
fix: update use endpoint in examples
matthias-pichler Jun 3, 2024
d33b1a0
fix: allow to specify endpoint as string as described in dsl
matthias-pichler Jun 3, 2024
7b5b0fc
docs: add shorthand endpoint example
matthias-pichler Jun 3, 2024
752c383
fix: use uri-template
matthias-pichler Jun 3, 2024
b242913
fix: update old example
matthias-pichler Jun 3, 2024
d01ded3
docs: update dsl docs
matthias-pichler Jun 4, 2024
b8f3e29
chore: update examples
matthias-pichler Jun 4, 2024
e695c2f
feat: update schema to use named tasks
matthias-pichler Jun 4, 2024
d7220a2
refactor: make for.do an array as well
matthias-pichler Jun 4, 2024
28742a5
Revert "refactor: make for.do an array as well"
matthias-pichler Jun 4, 2024
5abfe4d
test: update ctk
matthias-pichler Jun 4, 2024
f50bf6c
chore: update examples
matthias-pichler Jun 4, 2024
62b5fde
feat: update schema
matthias-pichler Jun 4, 2024
ecee0c1
test: update ctk files
matthias-pichler Jun 4, 2024
4b369e5
docs: update dsl
matthias-pichler Jun 4, 2024
183b8d3
fix: fix indentation of then
matthias-pichler Jun 4, 2024
f76b709
fix: update extend property
matthias-pichler Jun 4, 2024
acad3d7
refactor: replace compete with competitively
matthias-pichler Jun 4, 2024
03b8b46
Revert "refactor: replace compete with competitively"
matthias-pichler Jun 5, 2024
4da0614
Revert "fix: update extend property"
matthias-pichler Jun 5, 2024
b55e59c
fix: update examples
matthias-pichler Jun 5, 2024
a406b21
fix: update ctk
matthias-pichler Jun 5, 2024
901578a
Revert "feat: update schema"
matthias-pichler Jun 5, 2024
36761c6
revert splitting of composite
matthias-pichler Jun 5, 2024
2c79aa4
fix: rename name from task
matthias-pichler Jun 5, 2024
e850089
fix: move then to right level
matthias-pichler Jun 5, 2024
639f936
Revert "fix: rename name from task"
matthias-pichler Jun 5, 2024
dc721a3
fix: remove left over name properties
matthias-pichler Jun 5, 2024
9af40e3
Merge remote-tracking branch 'origin/main' into matthias-pichler/remo…
matthias-pichler Jun 5, 2024
dfe3e67
Merge branch 'main' into matthias-pichler/remove-reliance-875
matthias-pichler Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 39 additions & 44 deletions ctk/features/call.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ Feature: Call Task
namespace: default
name: http-call-with-content-output
do:
getFirstAvailablePet:
call: http
with:
method: get
endpoint:
uri: https://petstore.swagger.io/v2/pet/findByStatus?status={status}
output:
from: .[0]
call: http
with:
method: get
endpoint:
uri: https://petstore.swagger.io/v2/pet/findByStatus?status={status}
output:
from: .[0]
"""
And given the workflow input is:
"""yaml
Expand All @@ -43,13 +42,12 @@ Feature: Call Task
namespace: default
name: http-call-with-response-output
do:
getPetById:
call: http
with:
method: get
endpoint:
uri: https://petstore.swagger.io/v2/pet/{petId}
output: response
call: http
with:
method: get
endpoint:
uri: https://petstore.swagger.io/v2/pet/{petId}
output: response
"""
And given the workflow input is:
"""yaml
Expand All @@ -70,16 +68,15 @@ Feature: Call Task
namespace: default
name: http-call-with-basic-auth
do:
getSecuredEndpoint:
call: http
with:
method: get
endpoint:
uri: https://httpbin.org/basic-auth/{username}/{password}
authentication:
basic:
username: ${ .username }
password: ${ .password }
call: http
with:
method: get
endpoint:
uri: https://httpbin.org/basic-auth/{username}/{password}
authentication:
basic:
username: ${ .username }
password: ${ .password }
"""
And given the workflow input is:
"""yaml
Expand All @@ -99,16 +96,15 @@ Feature: Call Task
namespace: default
name: openapi-call-with-content-output
do:
getPetsByStatus:
call: openapi
with:
document:
uri: https://petstore.swagger.io/v2/swagger.json
operation: findPetsByStatus
parameters:
status: ${ .status }
output:
from: . | length
call: openapi
with:
document:
uri: https://petstore.swagger.io/v2/swagger.json
operation: findPetsByStatus
parameters:
status: ${ .status }
output:
from: . | length
"""
And given the workflow input is:
"""yaml
Expand All @@ -127,15 +123,14 @@ Feature: Call Task
namespace: default
name: openapi-call-with-response-output
do:
getPetById:
call: openapi
with:
document:
uri: https://petstore.swagger.io/v2/swagger.json
operation: getPetById
parameters:
petId: ${ .petId }
output: response
call: openapi
with:
document:
uri: https://petstore.swagger.io/v2/swagger.json
operation: getPetById
parameters:
petId: ${ .petId }
output: response
"""
And given the workflow input is:
"""yaml
Expand Down
24 changes: 11 additions & 13 deletions ctk/features/composite.feature
ricardozanini marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ Feature: Composite Task
namespace: default
name: composite-sequential
do:
setRGB:
execute:
sequentially:
setRed:
execute:
sequentially:
- setRed:
set:
colors: ${ .colors + ["red"] }
setGreen:
- setGreen:
set:
colors: ${ .colors + ["green"] }
setBlue:
- setBlue:
set:
colors: ${ .colors + ["blue"] }
"""
Expand All @@ -40,19 +39,18 @@ Feature: Composite Task
namespace: default
name: composite-sequential
do:
setRGB:
execute:
concurrently:
setRed:
execute:
compete: true
concurrently:
- setRed:
set:
colors: ${ .colors + ["red"] }
setGreen:
- setGreen:
set:
colors: ${ .colors + ["green"] }
setBlue:
- setBlue:
set:
colors: ${ .colors + ["blue"] }
compete: true
"""
When the workflow is executed
Then the workflow should complete
Expand Down
58 changes: 29 additions & 29 deletions ctk/features/data-flow.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ Feature: Data Flow
namespace: default
name: output-filtering
do:
setUsername:
input:
from: .user.claims.subject #filters the input of the task, using only the user's subject
set:
playerId: ${ . }
input:
from: .user.claims.subject #filters the input of the task, using only the user's subject
set:
playerId: ${ . }
"""
And given the workflow input is:
"""yaml
Expand All @@ -39,14 +38,13 @@ Feature: Data Flow
namespace: default
name: output-filtering
do:
getPetById:
call: http
with:
method: get
endpoint:
uri: https://petstore.swagger.io/v2/pet/{petId} #simple interpolation, only possible with top level variables
output:
from: .id #filters the output of the http call, using only the id of the returned object
call: http
with:
method: get
endpoint:
uri: https://petstore.swagger.io/v2/pet/{petId} #simple interpolation, only possible with top level variables
output:
from: .id #filters the output of the http call, using only the id of the returned object
"""
And given the workflow input is:
"""yaml
Expand All @@ -67,22 +65,24 @@ Feature: Data Flow
namespace: default
name: non-object-output
do:
getPetById1:
call: http
with:
method: get
endpoint:
uri: https://petstore.swagger.io/v2/pet/{petId} #simple interpolation, only possible with top level variables
output:
from: .id
getPetById2:
call: http
with:
method: get
endpoint:
uri: https://petstore.swagger.io/v2/pet/2
output:
from: '{ ids: [ $input, .id ] }'
execute:
sequentially:
- getPetById1:
call: http
with:
method: get
endpoint:
uri: https://petstore.swagger.io/v2/pet/{petId} #simple interpolation, only possible with top level variables
output:
from: .id
- getPetById2:
call: http
with:
method: get
endpoint:
uri: https://petstore.swagger.io/v2/pet/2
output:
from: '{ ids: [ $input, .id ] }'
"""
When the workflow is executed
Then the workflow should complete with output:
Expand Down
15 changes: 7 additions & 8 deletions ctk/features/emit.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ Feature: Emit Task
namespace: default
name: emit
do:
emitUserGreeted:
emit:
event:
with:
source: https://fake-source.com
type: com.fake-source.user.greeted.v1
data:
greetings: ${ "Hello \(.user.firstName) \(.user.lastName)!" }
emit:
event:
with:
source: https://fake-source.com
type: com.fake-source.user.greeted.v1
data:
greetings: ${ "Hello \(.user.firstName) \(.user.lastName)!" }
"""
And given the workflow input is:
"""yaml
Expand Down
46 changes: 25 additions & 21 deletions ctk/features/flow.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ Feature: Flow Directive
namespace: default
name: implicit-sequence
do:
setRed:
set:
colors: '${ .colors + [ "red" ] }'
setGreen:
set:
colors: '${ .colors + [ "green" ] }'
setBlue:
set:
colors: '${ .colors + [ "blue" ] }'
execute:
sequentially:
- setRed:
set:
colors: '${ .colors + [ "red" ] }'
- setGreen:
set:
colors: '${ .colors + [ "green" ] }'
- setBlue:
set:
colors: '${ .colors + [ "blue" ] }'
"""
When the workflow is executed
Then the workflow should complete with output:
Expand All @@ -38,18 +40,20 @@ Feature: Flow Directive
namespace: default
name: explicit-sequence
do:
setRed:
set:
colors: '${ .colors + [ "red" ] }'
then: setGreen
setBlue:
set:
colors: '${ .colors + [ "blue" ] }'
then: end
setGreen:
set:
colors: '${ .colors + [ "green" ] }'
then: setBlue
execute:
sequentially:
- setRed:
set:
colors: '${ .colors + [ "red" ] }'
then: setGreen
- setBlue:
set:
colors: '${ .colors + [ "blue" ] }'
then: end
- setGreen:
set:
colors: '${ .colors + [ "green" ] }'
then: setBlue
"""
When the workflow is executed
Then the workflow should complete with output:
Expand Down
13 changes: 6 additions & 7 deletions ctk/features/for.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ Feature: For Task
namespace: default
name: for
do:
forEachColor:
for:
each: color
in: '.colors'
do:
set:
processed: '${ { colors: (.processed.colors + [ $color ]), indexes: (.processed.indexes + [ $index ])} }'
for:
each: color
in: '.colors'
do:
set:
processed: '${ { colors: (.processed.colors + [ $color ]), indexes: (.processed.indexes + [ $index ])} }'
"""
And given the workflow input is:
"""yaml
Expand Down
11 changes: 5 additions & 6 deletions ctk/features/raise.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ Feature: Raise Task
namespace: default
name: raise-custom-error
do:
raiseComplianceError:
raise:
error:
status: 400
type: https://serverlessworkflow.io/errors/types/compliance
title: Compliance Error
raise:
error:
status: 400
type: https://serverlessworkflow.io/errors/types/compliance
title: Compliance Error
"""
When the workflow is executed
Then the workflow should fault with error:
Expand Down
9 changes: 4 additions & 5 deletions ctk/features/set.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ Feature: Set Task
namespace: default
name: set
do:
initialize:
set:
shape: circle
size: ${ .configuration.size }
fill: ${ .configuration.fill }
set:
shape: circle
size: ${ .configuration.size }
fill: ${ .configuration.fill }
"""
And given the workflow input is:
"""yaml
Expand Down
Loading
Loading