specification
specification copied to clipboard
Define specific rules when merging action output by default
What would you like to be added:
Define specific rules when merging action output by default
Why is this needed:
So far, the spec mandates that the output of an action without toState data filter should be merged back 'as is' into the state data.
Problem is, if the output of said action is not an object, merging it into state data will effectilvely fault the whole workflow: all evaluations will fail.
Image for instance an action that returns, say, an array or, why not, an integer. Your state was the following beforehand:
{
"someName": "someValue"
}
After the action, the state data would be:
[
1,
2,
3
]
Or why not something like:
125
Which would result in all further actions to fail. Consider, for example, a next action with a fromState data filter => BOOM.
What I propose is that the action output be merged back "as-is" ONLY if/when it's an object. If it's an array or a value type (string, bool, int, ...), it should instead be merged back into a 'actionOuput' property, for example. The name of that property could be based on the name of the action, such as myActionOutput.
WDYT?
@cdavernas, what we did in Kogito for those cases is to merge the non object json node with a "response" name.
Just to illustrate using your example, we then have an output like this:
{
"someName": "someValue",
"response": [1, 2, 3]
}
But it's definitely doable to have a definition at the spec level of what to do in such situations.
what we did in Kogito for those cases is to merge the non object json node with a "response" name.
Common sense indeed, but it would imho be nice to specify that in the spec so that users don't "discover" inconsistencies amongst runtimes.
Oh sure thing, I agree entirely with you. I remember we brought this to discussion, but didn't go further, so we did it by ourselves
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.