Serverless workflow: actionDataFilter failed to merge nested objects
See original GitHub issueDescribe the bug
Below is my action and the actionDataFilter ${ .collections.test }
didn’t work and it only gave me an output like { "test": "sth" }
.
{
"name": "test",
"type": "operation",
"actions": [{
"name": "Collect Inputs",
"functionRef": {
"refName": "collect",
"arguments": {
"stepName": "test",
"stepVersion": "1.0.0",
"subject": "globefish",
"bucket": ".destination.bucket",
"prefix": ".destination.key",
"action": "input"
}
},
"actionDataFilter": {
"toStateData": "${ .collections.test }"
}
}
],
"end": true
}
Expected behavior
The workflow should be { "collections": { "test": "sth" } }
.
Actual behavior
{ "test": "sth" }
How to Reproduce?
- set
actionDataFilter.toStateData
with a nested path likea.b
- run the workflow
- Get the response
Output of uname -a
or ver
Linux ubuntu 5.15.79.1-microsoft-standard-WSL2 #1 SMP Wed Nov 23 01:01:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
openjdk version “17.0.5” 2022-10-18 OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8) OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Kogito version or git rev (or at least Quarkus version if you are using Kogito via Quarkus platform BOM)
Quarkus 2.14.3.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63) Maven home: /home/littlefox/.m2/wrapper/dists/apache-maven-3.8.6-bin/67568434/apache-maven-3.8.6 Java version: 17.0.5, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-17-jdk-amd64 Default locale: en, platform encoding: UTF-8 OS name: “linux”, version: “5.15.79.1-microsoft-standard-wsl2”, arch: “amd64”, family: “unix”
Additional information
No response
Issue Analytics
- State:
- Created 9 months ago
- Comments:11 (7 by maintainers)
It is the “same” issue (different perceiverd result, but same underlying issue) , toStateData is using b to merge and ignoring a (so mergde b object, containing initial m plus function returned greeting is now in two places, under root and under a)
Use results instead of toStateData. So results looks like “${a:{b:{greeting : .greeting}}}” and there is no toStateData. Im going to modify toStateData to behave properly, but till then, use results (which can do esentially the same than toStateData)
Another point that is not clearly set by the spec is what happens is your data is an array and there is already an array in collection.tests, how do you merge them? In Kogito we decided to not merge arrays and replace the value, if existing ( think of merging [1,2,3,4] and [5,4,3,2,1], which will be the expected result?