Skip to content

[Fix #712] Describe merge behaviour for non object #832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ The second way would be to directly filter only the "veggie like" vegetables wit
| fromStateData | Workflow expression that filters state data that can be used by the action | string | no |
| useResults | If set to `false`, action data results are not added/merged to state data. In this case 'results' and 'toStateData' should be ignored. Default is `true`. | boolean | no |
| results | Workflow expression that filters the actions data results | string | no |
| toStateData | Workflow expression that selects a state data element to which the action results should be added/merged into. If not specified denotes the top-level state data element | string | no |
| toStateData | Workflow expression that selects a state data element to which the action results should be added/merged. If not specified denotes the top-level state data element. In case it is not specified and the result of the action is not an object, that result should be merged as the value of an automatically generated key. That key name will be the result of concatenating the action name with `-output` suffix. | string | no |

<details><summary><strong>Click to view example definition</strong></summary>
<p>
Expand Down Expand Up @@ -565,6 +565,26 @@ into. With this, after our action executes the state data would be:
}
```

To illustrate the merge of non-JSON for both objects, let's assume that, in the previous example, the action definition is the follows

```json
"actions":[
{
"name": "fetch-only-pasta",
"functionRef": "breadAndPastaTypesFunction",
"actionDataFilter": {
"results": "${ .pasta[1] ]",
}
}
]
```
Since there is no `toStateData` attribute and the result is not a JSON object but a string, the model would be:

```json
{
"fetch-only-pasta-output": "spaghetti"
}
```
In the case action results should not be added/merged to state data, we can set the `useResults` property to `false`.
In this case, the `results` and `toStateData` properties should be ignored, and nothing is added/merged to state data.
If `useResults` is not specified (or it's value set to `true`), action results, if available, should be added/merged to state data.
Expand Down