|
44 | 44 | + [Retry](#retry) |
45 | 45 | + [Input](#input) |
46 | 46 | + [Output](#output) |
| 47 | + + [Export] (#export) |
47 | 48 | + [Timeout](#timeout) |
48 | 49 | + [Duration](#duration) |
49 | 50 | + [HTTP Response](#http-response) |
|
183 | 184 | - getAvailablePets: |
184 | 185 | call: getAvailablePets |
185 | 186 | output: |
186 | | - from: "$input + { availablePets: [.[] | select(.category.name == \"dog\" and (.tags[] | .breed == $input.order.breed))] }" |
| 187 | + as: "$input + { availablePets: [.[] | select(.category.name == \"dog\" and (.tags[] | .breed == $input.order.breed))] }" |
187 | 188 | - submitMatchesByMail: |
188 | 189 | call: http |
189 | 190 | with: |
@@ -241,6 +242,7 @@ The Serverless Workflow DSL defines a list of [tasks](#task) that **must be** su |
241 | 242 | |:--|:---:|:---:|:---| |
242 | 243 | | input | [`input`](#input) | `no` | An object used to customize the task's input and to document its schema, if any. | |
243 | 244 | | output | [`output`](#output) | `no` | An object used to customize the task's output and to document its schema, if any. | |
| 245 | +| export | [`export`](#export) | `no` | An object used to customize the content of the workflow context. | |
244 | 246 | | timeout | [`timeout`](#timeout) | `no` | The configuration of the task's timeout, if any. | |
245 | 247 | | then | [`flowDirective`](#flow-directive) | `no` | The flow directive to execute next.<br>*If not set, defaults to `continue`.* | |
246 | 248 |
|
|
572 | 574 | with: |
573 | 575 | type: com.fake.petclinic.pets.checkup.completed.v2 |
574 | 576 | output: |
575 | | - to: '.pets + [{ "id": $pet.id }]' |
| 577 | + as: '.pets + [{ "id": $pet.id }]' |
576 | 578 | ``` |
577 | 579 |
|
578 | 580 | #### Listen |
@@ -1490,6 +1492,33 @@ from: |
1490 | 1492 | to: '.petList += [ . ]' |
1491 | 1493 | ``` |
1492 | 1494 |
|
| 1495 | +### Export |
| 1496 | + |
| 1497 | +Certain task needs to set the workflow context to save the task output for later usage. Users set the content of the context through a runtime expression. The result of the expression is the new value of the context. The expression is evaluated against the existing context. |
| 1498 | + |
| 1499 | +Optionally, the context might have an associated schema. |
| 1500 | + |
| 1501 | +#### Properties |
| 1502 | + |
| 1503 | +| Property | Type | Required | Description | |
| 1504 | +|----------|:----:|:--------:|-------------| |
| 1505 | +| 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.* | |
| 1506 | +| as | `string`<br>`object` | `no` | A runtime expression, if any, used to export the output data to the context. | |
| 1507 | + |
| 1508 | +#### Examples |
| 1509 | + |
| 1510 | +Merge the task output into the current context. |
| 1511 | + |
| 1512 | +```yaml |
| 1513 | +as: '.+$output' |
| 1514 | +``` |
| 1515 | + |
| 1516 | +Replace the context with the task output. |
| 1517 | + |
| 1518 | +```yaml |
| 1519 | +as: $output |
| 1520 | +``` |
| 1521 | + |
1493 | 1522 | ### Schema |
1494 | 1523 |
|
1495 | 1524 | Describes a data schema. |
|
0 commit comments