diff --git a/examples/README.md b/examples/README.md index 0bf7f396..e5a9dafc 100644 --- a/examples/README.md +++ b/examples/README.md @@ -174,7 +174,7 @@ Which is added to the states data and becomes the workflow data output. "name": "${ .person.name }" } }, - "actionDataFilter": { + "dataFilter": { "results": "${ {greeting: .greeting} }" } } @@ -206,7 +206,7 @@ states: refName: greetingFunction arguments: name: "${ .person.name }" - actionDataFilter: + dataFilter: results: "${ {greeting: .greeting} }" end: true ``` @@ -252,7 +252,7 @@ Note that in the workflow definition you can see two filters defined. The event ```json { - "eventDataFilter": { + "dataFilter": { "data": "${ .data.greet } " } } @@ -265,7 +265,7 @@ The second, a state data filter, which is defined on the event state itself: ```json { - "stateDataFilter": { + "dataFilter": { "output": "${ .payload.greeting }" } } @@ -320,7 +320,7 @@ filters what is selected to be the state data output which then becomes the work "type":"event", "onEvents": [{ "eventRefs": ["GreetingEvent"], - "eventDataFilter": { + "dataFilter": { "data": "${ .greet }", "toStateData": "${ .greet }" }, @@ -335,7 +335,7 @@ filters what is selected to be the state data output which then becomes the work } ] }], - "stateDataFilter": { + "dataFilter": { "output": "${ .payload.greeting }" }, "end": true @@ -367,7 +367,7 @@ states: onEvents: - eventRefs: - GreetingEvent - eventDataFilter: + dataFilter: data: "${ .greet }" toStateData: "${ .greet }" actions: @@ -375,7 +375,7 @@ states: refName: greetingFunction arguments: name: "${ .greet.name }" - stateDataFilter: + dataFilter: output: "${ .payload.greeting }" end: true ``` @@ -452,7 +452,7 @@ result of the workflow execution. } } ], - "stateDataFilter": { + "dataFilter": { "output": "${ .results }" }, "end": true @@ -485,7 +485,7 @@ states: refName: solveMathExpressionFunction arguments: expression: "${ .singleexpression }" - stateDataFilter: + dataFilter: output: "${ .results }" end: true ``` @@ -1127,7 +1127,7 @@ The data output of the workflow contains the information of the exception caught } } ], - "stateDataFilter": { + "dataFilter": { "output": "${ .exceptions }" }, "transition": "ApplyOrder", @@ -1216,7 +1216,7 @@ states: refName: provisionOrderFunction arguments: order: "${ .order }" - stateDataFilter: + dataFilter: output: "${ .exceptions }" transition: ApplyOrder onErrors: @@ -1322,12 +1322,12 @@ In the case job submission raises a runtime error, we transition to an Operation "name": "${ .job.name }" } }, - "actionDataFilter": { + "dataFilter": { "results": "${ .jobuid }" } } ], - "stateDataFilter": { + "dataFilter": { "output": "${ .jobuid }" }, "transition": "WaitForCompletion" @@ -1350,12 +1350,12 @@ In the case job submission raises a runtime error, we transition to an Operation "name": "${ .jobuid }" } }, - "actionDataFilter": { + "dataFilter": { "results": "${ .jobstatus }" } } ], - "stateDataFilter": { + "dataFilter": { "output": "${ .jobstatus }" }, "transition": "DetermineCompletion" @@ -1441,9 +1441,9 @@ states: refName: submitJob arguments: name: "${ .job.name }" - actionDataFilter: + dataFilter: results: "${ .jobuid }" - stateDataFilter: + dataFilter: output: "${ .jobuid }" transition: WaitForCompletion - name: WaitForCompletion @@ -1458,9 +1458,9 @@ states: refName: checkJobStatus arguments: name: "${ .jobuid }" - actionDataFilter: + dataFilter: results: "${ .jobstatus }" - stateDataFilter: + dataFilter: output: "${ .jobstatus }" transition: DetermineCompletion - name: DetermineCompletion @@ -2625,7 +2625,7 @@ For this example we assume that the workflow instance is started given the follo "data": "${ .patientInfo }", "consumeEventRef": "VetAppointmentInfo" }, - "actionDataFilter": { + "dataFilter": { "results": "${ .appointmentInfo }" } } @@ -2667,7 +2667,7 @@ states: produceEventRef: MakeVetAppointment data: "${ .patientInfo }" consumeEventRef: VetAppointmentInfo - actionDataFilter: + dataFilter: results: "${ .appointmentInfo }" timeouts: actionExecTimeout: PT15M @@ -3431,7 +3431,7 @@ the data for an hour, send report, and so on. } } ], - "eventDataFilter": { + "dataFilter": { "toStateData": "${ .readings }" } } @@ -3515,7 +3515,7 @@ states: actions: - functionRef: refName: LogReading - eventDataFilter: + dataFilter: toStateData: "${ .readings }" end: true - name: GenerateReport @@ -4164,7 +4164,7 @@ Its results are then merged back into the state data according to the "toStateDa "actions": [ { "functionRef": "Increment Current Count Function", - "actionDataFilter": { + "dataFilter": { "toStateData": ".counts.current" } } @@ -4204,7 +4204,7 @@ states: type: operation actions: - functionRef: Increment Current Count Function - actionDataFilter: + dataFilter: toStateData: ".counts.current" transition: Check if full ``` @@ -4344,7 +4344,7 @@ states: onEvents: - eventRefs: - ETA Deadline Event - eventDataFilter: + dataFilter: data: "${ .results.status }" toStateData: "${ .status }" transition: Deliver Order @@ -4360,10 +4360,10 @@ states: refName: Charge For Order Function arguments: order: "${ .order.id }" - actionDataFilter: + dataFilter: results: "${ .outcome.status }" toStateData: "${ .status }" - stateDataFilter: + dataFilter: output: '${ . | {"orderid": .id, "orderstatus": .status} | .orderstatus += ["Order Completed"] }' end: true @@ -4390,7 +4390,7 @@ states: refName: Submit Order Function arguments: order: "${ .order }" - actionDataFilter: + dataFilter: results: "${ .results.status }" toStateData: "${ .status }" - functionRef: @@ -4399,7 +4399,7 @@ states: customer: "${ .customerId }" restaurantid: "${ .order.restaurantId }" delivery: " ${ .delivery }" - actionDataFilter: + dataFilter: results: "${ .results.status }" toStateData: "${ .status }" end: true @@ -4424,7 +4424,7 @@ states: onEvents: - eventRefs: - Order Picked Up Event - eventDataFilter: + dataFilter: data: "${ .data.status }" toStateData: "${ .status }" actions: @@ -4435,7 +4435,7 @@ states: onEvents: - eventRefs: - Order Delievered Event - eventDataFilter: + dataFilter: data: "${ .data.status }" toStateData: "${ .status }" end: true @@ -4511,7 +4511,7 @@ We assume that our workflow input has the runtime-imposed quota: "eventRefs":[ "CustomerEvent" ], - "eventDataFilter":{ + "dataFilter":{ "data":"${ .customerId }", "toStateData":"${ .eventCustomerId }" }, @@ -4527,7 +4527,7 @@ We assume that our workflow input has the runtime-imposed quota: ] } ], - "stateDataFilter":{ + "dataFilter":{ "output":"${ .count = .count + 1 }" }, "transition":"CheckEventQuota" @@ -4583,7 +4583,7 @@ states: onEvents: - eventRefs: - CustomerEvent - eventDataFilter: + dataFilter: data: "${ .customerId }" toStateData: "${ .eventCustomerId }" actions: @@ -4591,7 +4591,7 @@ states: refName: NotifyCustomerFunction arguments: customerId: "${ .eventCustomerId }" - stateDataFilter: + dataFilter: output: "${ .count = .count + 1 }" transition: CheckEventQuota - name: CheckEventQuota diff --git a/roadmap/README.md b/roadmap/README.md index 902262c3..9f84dba9 100644 --- a/roadmap/README.md +++ b/roadmap/README.md @@ -36,6 +36,7 @@ _Status description:_ | ✔️| 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) | | ✔️| Add the new `WORKFLOW` reserved keyword to workflow expressions | | ✔️| Update `ForEach` state iteration parameter example. This parameter is an expression variable, not a JSON property | +| ✔️| Renamed data filter properties (`stateDataFilter`, `actionDataFilter`, ...) into `dataFilter` both to avoid redundancy and improve definition readability | ✏️️| Add inline state defs in branches | | | ✏️️| Update rest function definition | | | ✏️️| Add "completedBy" functionality | | diff --git a/schema/workflow.json b/schema/workflow.json index dae1bd54..12914e99 100644 --- a/schema/workflow.json +++ b/schema/workflow.json @@ -419,7 +419,7 @@ }, "additionalItems": false }, - "eventDataFilter": { + "dataFilter": { "description": "Event data filter", "$ref": "#/definitions/eventdatafilter" } @@ -474,7 +474,7 @@ }, "additionalItems": false }, - "actionDataFilter": { + "dataFilter": { "description": "Action data filter", "$ref": "#/definitions/actiondatafilter" }, @@ -754,7 +754,7 @@ }, "required": [] }, - "stateDataFilter": { + "dataFilter": { "description": "State data filter", "$ref": "#/definitions/statedatafilter" }, @@ -821,7 +821,7 @@ "$ref": "#/definitions/end", "description": "State end definition" }, - "stateDataFilter": { + "dataFilter": { "description": "State data filter", "$ref": "#/definitions/statedatafilter" }, @@ -938,7 +938,7 @@ "$ref": "#/definitions/end", "description": "State end definition" }, - "stateDataFilter": { + "dataFilter": { "description": "State data filter", "$ref": "#/definitions/statedatafilter" }, @@ -1071,7 +1071,7 @@ "const": "switch", "description": "State type" }, - "stateDataFilter": { + "dataFilter": { "description": "State data filter", "$ref": "#/definitions/statedatafilter" }, @@ -1145,7 +1145,7 @@ "const": "switch", "description": "State type" }, - "stateDataFilter": { + "dataFilter": { "description": "State data filter", "$ref": "#/definitions/statedatafilter" }, @@ -1258,7 +1258,7 @@ "description": "Next transition of the workflow if there is valid matches", "$ref": "#/definitions/transition" }, - "eventDataFilter": { + "dataFilter": { "description": "Event data filter definition", "$ref": "#/definitions/eventdatafilter" }, @@ -1288,7 +1288,7 @@ "$ref": "#/definitions/end", "description": "Explicit transition to end" }, - "eventDataFilter": { + "dataFilter": { "description": "Event data filter definition", "$ref": "#/definitions/eventdatafilter" }, @@ -1385,7 +1385,7 @@ "type": "object", "description": "JSON object which can be set as states data input and can be manipulated via filters" }, - "stateDataFilter": { + "dataFilter": { "description": "State data filter", "$ref": "#/definitions/statedatafilter" }, @@ -1506,7 +1506,7 @@ }, "required": [] }, - "stateDataFilter": { + "dataFilter": { "description": "State data filter", "$ref": "#/definitions/statedatafilter" }, diff --git a/specification.md b/specification.md index 9364266a..307ac186 100644 --- a/specification.md +++ b/specification.md @@ -319,7 +319,7 @@ The workflow data output is the data output of the last executed workflow state. ```json { - "stateDataFilter": { + "dataFilter": { "input": "${ .orders }", "output": "${ .provisionedOrders }" } @@ -330,7 +330,7 @@ The workflow data output is the data output of the last executed workflow state.
@@ -3751,7 +3751,7 @@ This is visualized in the diagram below:
| [retryRef](#retry-definition) | References a defined workflow retry definition. If not defined uses the default runtime retry definition | string | no |
| nonRetryableErrors | List of references to defined [workflow errors](#Defining-Errors) for which the action should not be retried. Used only when `autoRetries` is set to `true` | array | no |
| retryableErrors | List of references to defined [workflow errors](#Defining-Errors) for which the action should be retried. Used only when `autoRetries` is set to `false` | array | no |
-| [actionDataFilter](#Action-data-filters) | Action data filter definition | object | no |
+| [dataFilter](#Action-data-filters) | Action data filter definition | object | no |
| sleep | Defines time periods workflow execution should sleep before / after function execution | object | no |
| [condition](#Workflow-Expressions) | Expression, if defined, must evaluate to `true` for this action to be performed. If `false`, action is disregarded | string | no |
@@ -3931,7 +3931,7 @@ Here is an example of using the `arguments` property:
The `invoke` property defines how the function is invoked (sync or async). Default value of this property is
`sync`, meaning that workflow execution should wait until the function completes.
If set to `async`, workflow execution should just invoke the function and should not wait until its completion.
-Note that in this case the action does not produce any results and the associated actions actionDataFilter as well as
+Note that in this case the action does not produce any results and the associated actions dataFilter as well as
its retry definition, if defined, should be ignored.
In addition, functions that are invoked async do not propagate their errors to the associated action definition and the
workflow state, meaning that any errors that happen during their execution cannot be handled in the workflow states
@@ -4002,7 +4002,7 @@ that can be handled in the states `onErrors` definition. In case the `consumeEve
The `invoke` property defines how the function is invoked (sync or async). Default value of this property is
`sync`, meaning that workflow execution should wait until the function completes (the result event is received).
If set to `async`, workflow execution should just produce the trigger event and should not wait for the result event.
-Note that in this case the action does not produce any results (payload of the result event) and the associated actions eventDataFilter as well as
+Note that in this case the action does not produce any results (payload of the result event) and the associated actions dataFilter as well as
its retry definition, if defined, should be ignored.
Functions that are invoked via events (sync or async) do not propagate their errors to the associated action definition and the
workflow state, meaning that any errors that happen during their execution cannot be handled in the workflow states
@@ -4072,7 +4072,7 @@ defined in the sub-workflow definition.
The `invoke` property defines how the subflow is invoked (sync or async). Default value of this property is
`sync`, meaning that workflow execution should wait until the subflow completes.
If set to `async`, workflow execution should just invoke the subflow and not wait for its results.
-Note that in this case the action does not produce any results, and the associated actions actionDataFilter as well as
+Note that in this case the action does not produce any results, and the associated actions dataFilter as well as
its retry definition, if defined, should be ignored.
Subflows that are invoked async do not propagate their errors to the associated action definition and the
workflow state, meaning that any errors that happen during their execution cannot be handled in the workflow states
@@ -4404,7 +4404,7 @@ definitions are mutually exclusive, meaning that you can specify either one or t
| eventRef | References an unique event name in the defined workflow events | string | yes |
| [transition](#Transitions) | Transition to another state if condition is `true` | string or object | yes (if `end` is not defined) |
| [end](#End-Definition) | End workflow execution if condition is `true` | boolean or object | yes (if `transition` is not defined) |
-| [eventDataFilter](#Event-data-filters) | Event data filter definition | object | no |
+| [dataFilter](#Event-data-filters) | Event data filter definition | object | no |
| [metadata](#Workflow-Metadata) | Metadata information| object | no |
Click to view example definition
@@ -4448,7 +4448,7 @@ The `eventRef` property references a name of one of the defined workflow events.
If the referenced event is received, you can specify either the `transition` or `end` definitions
to decide what to do, transition to another workflow state, or end workflow execution.
-The `eventDataFilter` property can be used to filter event data when it is received.
+The `dataFilter` property can be used to filter event data when it is received.
Note that `transition` and `end`
definitions are mutually exclusive, meaning that you can specify either one or the other, but not both.