Skip to content

Commit f3bf7c7

Browse files
committed
[Fix_#873] Rename output.from and output.to
output.from is renamed as output.as output.to is renamed as export.as
1 parent 8c92c23 commit f3bf7c7

File tree

2 files changed

+44
-6
lines changed

2 files changed

+44
-6
lines changed

dsl-reference.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ do:
176176
- getAvailablePets:
177177
call: getAvailablePets
178178
output:
179-
from: "$input + { availablePets: [.[] | select(.category.name == "dog" and (.tags[] | .breed == $input.order.breed))] }"
179+
as: "$input + { availablePets: [.[] | select(.category.name == "dog" and (.tags[] | .breed == $input.order.breed))] }"
180180
- submitMatchesByMail:
181181
call: http
182182
with:
@@ -234,6 +234,7 @@ The Serverless Workflow DSL defines a list of [tasks](#task) that **must be** su
234234
|:--|:---:|:---:|:---|
235235
| input | [`input`](#input) | `no` | An object used to customize the task's input and to document its schema, if any. |
236236
| output | [`output`](#output) | `no` | An object used to customize the task's output and to document its schema, if any. |
237+
| export | [`export`](#export) | `no` | An object used to customize the content of the workflow context. |
237238
| timeout | [`timeout`](#timeout) | `no` | The configuration of the task's timeout, if any. |
238239
| then | [`flowDirective`](#flow-directive) | `no` | The flow directive to execute next.<br>*If not set, defaults to `continue`.* |
239240

@@ -558,7 +559,7 @@ do:
558559
with:
559560
type: com.fake.petclinic.pets.checkup.completed.v2
560561
output:
561-
to: '.pets + [{ "id": $pet.id }]'
562+
as: '.pets + [{ "id": $pet.id }]'
562563
```
563564

564565
#### Listen
@@ -1416,6 +1417,36 @@ from:
14161417
to: '.petList += [ . ]'
14171418
```
14181419

1420+
### Export
1421+
1422+
Certain task needs to set the context of the workflow using the task output for later usage. User set the content of the context through a runtime expression. The result of the expression is the new value of the context. If user want to merge the new data into the current context, he might do that using `$context` variable.
1423+
1424+
Optionally, the context can have a predefined schema.
1425+
1426+
1427+
#### Properties
1428+
1429+
| Property | Type | Required | Description |
1430+
|----------|:----:|:--------:|-------------|
1431+
| schema | [`schema`](#schema) | `no` | The [`schema`](#schema) used to describe and validate context.<br>*Included to handle the non frequent case in which the context has a known format.* |
1432+
| as | `string`<br>`object` | `no` | A [runtime expression](#runtime-expressions), if any, used to set the context value. |
1433+
1434+
#### Examples
1435+
1436+
Assuming the output of the task is a json object (not primitive, not array)
1437+
Merge into the current context the output of the task.
1438+
1439+
```yaml
1440+
as: '$context+=.'
1441+
```
1442+
1443+
Replace the context with the output of the task.
1444+
1445+
```yaml
1446+
as: .
1447+
```
1448+
1449+
14191450
### Schema
14201451

14211452
Describes a data schema.

schema/workflow.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,13 +816,20 @@ $defs:
816816
schema:
817817
$ref: '#/$defs/schema'
818818
description: The schema used to describe and validate the output of the workflow or task.
819-
from:
819+
as:
820820
type: string
821821
description: A runtime expression, if any, used to mutate and/or filter the output of the workflow or task.
822-
to:
823-
type: string
824-
description: A runtime expression, if any, used to output data to the current context.
825822
description: Configures the output of a workflow or task.
823+
export:
824+
type: object
825+
properties:
826+
schema:
827+
$ref: '#/$defs/schema'
828+
description: The schema used to describe and validate the workflow context.
829+
as:
830+
type: string
831+
description: A runtime expression, if any, used to set the context with output data.
832+
description: Set the content of the context.
826833
retryPolicy:
827834
type: object
828835
properties:

0 commit comments

Comments
 (0)