|
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)
|
|
176 | 177 | - getAvailablePets:
|
177 | 178 | call: getAvailablePets
|
178 | 179 | output:
|
179 |
| - from: "$input + { availablePets: [.[] | select(.category.name == "dog" and (.tags[] | .breed == $input.order.breed))] }" |
| 180 | + as: "$input + { availablePets: [.[] | select(.category.name == "dog" and (.tags[] | .breed == $input.order.breed))] }" |
180 | 181 | - submitMatchesByMail:
|
181 | 182 | call: http
|
182 | 183 | with:
|
@@ -234,6 +235,7 @@ The Serverless Workflow DSL defines a list of [tasks](#task) that **must be** su
|
234 | 235 | |:--|:---:|:---:|:---|
|
235 | 236 | | input | [`input`](#input) | `no` | An object used to customize the task's input and to document its schema, if any. |
|
236 | 237 | | output | [`output`](#output) | `no` | An object used to customize the task's output and to document its schema, if any. |
|
| 238 | +| export | [`export`](#export) | `no` | An object used to customize the content of the workflow context. | |
237 | 239 | | timeout | [`timeout`](#timeout) | `no` | The configuration of the task's timeout, if any. |
|
238 | 240 | | then | [`flowDirective`](#flow-directive) | `no` | The flow directive to execute next.<br>*If not set, defaults to `continue`.* |
|
239 | 241 |
|
|
558 | 560 | with:
|
559 | 561 | type: com.fake.petclinic.pets.checkup.completed.v2
|
560 | 562 | output:
|
561 |
| - to: '.pets + [{ "id": $pet.id }]' |
| 563 | + as: '.pets + [{ "id": $pet.id }]' |
562 | 564 | ```
|
563 | 565 |
|
564 | 566 | #### Listen
|
@@ -1416,6 +1418,33 @@ from:
|
1416 | 1418 | to: '.petList += [ . ]'
|
1417 | 1419 | ```
|
1418 | 1420 |
|
| 1421 | +### Export |
| 1422 | + |
| 1423 | +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. |
| 1424 | + |
| 1425 | +Optionally, the context might have an associated schema. |
| 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, if any, used to export the output data to the context. | |
| 1433 | + |
| 1434 | +#### Examples |
| 1435 | + |
| 1436 | +Merge the task output into the current context. |
| 1437 | + |
| 1438 | +```yaml |
| 1439 | +as: '.+$output' |
| 1440 | +``` |
| 1441 | + |
| 1442 | +Replace the context with the task output. |
| 1443 | + |
| 1444 | +```yaml |
| 1445 | +as: $output |
| 1446 | +``` |
| 1447 | + |
1419 | 1448 | ### Schema
|
1420 | 1449 |
|
1421 | 1450 | Describes a data schema.
|
|
0 commit comments