|
176 | 176 | - getAvailablePets:
|
177 | 177 | call: getAvailablePets
|
178 | 178 | 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))] }" |
180 | 180 | - submitMatchesByMail:
|
181 | 181 | call: http
|
182 | 182 | with:
|
@@ -234,6 +234,7 @@ The Serverless Workflow DSL defines a list of [tasks](#task) that **must be** su
|
234 | 234 | |:--|:---:|:---:|:---|
|
235 | 235 | | input | [`input`](#input) | `no` | An object used to customize the task's input and to document its schema, if any. |
|
236 | 236 | | 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. | |
237 | 238 | | timeout | [`timeout`](#timeout) | `no` | The configuration of the task's timeout, if any. |
|
238 | 239 | | then | [`flowDirective`](#flow-directive) | `no` | The flow directive to execute next.<br>*If not set, defaults to `continue`.* |
|
239 | 240 |
|
|
558 | 559 | with:
|
559 | 560 | type: com.fake.petclinic.pets.checkup.completed.v2
|
560 | 561 | output:
|
561 |
| - to: '.pets + [{ "id": $pet.id }]' |
| 562 | + as: '.pets + [{ "id": $pet.id }]' |
562 | 563 | ```
|
563 | 564 |
|
564 | 565 | #### Listen
|
@@ -1416,6 +1417,36 @@ from:
|
1416 | 1417 | to: '.petList += [ . ]'
|
1417 | 1418 | ```
|
1418 | 1419 |
|
| 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 | + |
1419 | 1450 | ### Schema
|
1420 | 1451 |
|
1421 | 1452 | Describes a data schema.
|
|
0 commit comments