Skip to content

Commit 5416d5b

Browse files
Introduce the WORFLOW keyword to expressions (#603)
* Introduce the WORFLOW keyword to expressions Signed-off-by: Ricardo Zanini <[email protected]> * Update roadmap Signed-off-by: Ricardo Zanini <[email protected]> * Update index Signed-off-by: Ricardo Zanini <[email protected]>
1 parent c2cb4e3 commit 5416d5b

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

roadmap/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ _Status description:_
3434
| ✔️| Update eventRef props to`resultEventTimeout` and `consumeEventTimeout` [spec doc](https://github.com/serverlessworkflow/specification/blob/main/specification.md#EventRef-Definition) |
3535
| ✔️| Apply fixes to auth spec schema [workflow schema](https://github.com/serverlessworkflow/specification/tree/main/schema) |
3636
| ✔️| Update the `dataInputSchema` top-level property by supporting the assignment of a JSON schema object [workflow schema](https://github.com/serverlessworkflow/specification/tree/main/specification.md#workflow-definition-structure) |
37+
| ✔️| Add the new `WORKFLOW` reserved keyword to workflow expressions |
3738
| ✏️️| Add inline state defs in branches | |
3839
| ✏️️| Update rest function definition | |
3940
| ✏️️| Add "completedBy" functionality | |

specification.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
* [Workflow Constants](#workflow-constants)
9797
* [Workflow Secrets](#workflow-secrets)
9898
* [Workflow Metadata](#workflow-metadata)
99+
* [Workflow Context](#workflow-context)
99100
- [Extensions](#extensions)
100101
- [Use Cases](#use-cases)
101102
- [Examples](#examples)
@@ -6170,6 +6171,44 @@ Some other examples of information that could be recorded in metadata are:
61706171
- Logging, monitoring, analytics, or audit repository information.
61716172
- Labels used for organizing/indexing purposes, such as "release" "stable", "track", "daily", etc.
61726173

6174+
### Workflow Context
6175+
6176+
Similar to [Constants](https://github.com/serverlessworkflow/specification/blob/main/specification.md#workflow-constants) and [Secrets](https://github.com/serverlessworkflow/specification/blob/main/specification.md#workflow-secrets), workflows expressions can have access to the context information of a running instance via the keyword `WORKFLOW`.
6177+
6178+
Implementations may use this keyword to give access to any relevant information of the running instance within an expression. For example:
6179+
6180+
```json
6181+
6182+
{
6183+
"id": "processSalesOrders",
6184+
"name": "Process Sales Orders",
6185+
"version": "1.0",
6186+
"specVersion": "0.8",
6187+
"start": "MyStartingState",
6188+
"functions": [{
6189+
"name": "myFunction",
6190+
"operation": "myopenapi.json#myFunction"
6191+
}],
6192+
"states":[
6193+
{
6194+
"name":"MyStartingState",
6195+
"type":"operation",
6196+
"actions": [{
6197+
"functionRef": "myFunction",
6198+
"args": {
6199+
"order": "${ .orderId }",
6200+
"callerId": "${ $WORKFLOW.instanceId }"
6201+
}
6202+
}],
6203+
"end": true
6204+
}]
6205+
}
6206+
```
6207+
6208+
In this use case, a third-party service may require information from the caller for traceability purposes.
6209+
6210+
The specification doesn't define any specific variable within the `WORKFLOW` bucket, but it's considered a reserved keyword.
6211+
61736212
## Extensions
61746213

61756214
The workflow extension mechanism allows you to enhance your model definitions with additional information useful for

0 commit comments

Comments
 (0)