-
Notifications
You must be signed in to change notification settings - Fork 213
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
Serverless workflow: actionDataFilter failed to merge nested objects #2686
Comments
I was not able to fully understand the scenario |
Let me try to make it clear. BTW, this is from another account of @GlobeFishNG.
{
"collections": { "test": { "name": "pepa"} }
}
{
"test": { "name": "pepa"}
} When I tried to merge it into the root using only |
Ok, got it now. |
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? |
I will try it. Thanks a lot. |
In any case, Ill to support "toStateData" : "${collection.test}" by making it equivalent to "data":"${collections.test:.}" for completeness, because this will happen to more people, thanks for the feedback ;) |
@fjtirado Found another issue :) {
"id": "hello_world",
"version": "1.0",
"specVersion": "0.8",
"name": "Hello World Workflow",
"description": "JSON based hello world workflow",
"start": "Inject",
"functions": [
{
"name": "greetingFunction",
"operation": "http://localhost:3000/api-json#GreetingsController_create"
}
],
"states": [
{
"name": "Inject",
"type": "inject",
"data": {
"a": {
"b": {
"m": "m"
}
}
},
"transition": "Greet"
},
{
"name":"Greet",
"type":"operation",
"actions":[
{
"functionRef": {
"refName": "greetingFunction",
"arguments": {
"person": ".person"
}
},
"actionDataFilter": {
"results": "{ greeting: .greeting }",
"toStateData": "${ .a.b }"
}
}
],
"end": true
}
]
} And the result is ➜ ~ http -vv POST localhost:8080/hello_world person:='{"name":"John"}'
POST /hello_world HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 28
Content-Type: application/json
Host: localhost:8080
User-Agent: HTTPie/3.2.1
{
"person": {
"name": "John"
}
}
HTTP/1.1 201 Created
Content-Type: application/json
Location: http://localhost:8080/hello_world/0a72bd9f-7c0d-4eeb-807e-2a3b3303a947
content-length: 223
{
"id": "0a72bd9f-7c0d-4eeb-807e-2a3b3303a947",
"workflowdata": {
"a": {
"b": {
"greeting": "Welcome to Serverless Workflow, John!",
"m": "m"
}
},
"b": {
"greeting": "Welcome to Serverless Workflow, John!",
"m": "m"
},
"person": {
"name": "John"
}
}
} |
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) |
Created https://issues.redhat.com/browse/KOGITO-8360 to change toStateData to behave properly |
Great!!! |
Describe the bug
Below is my action and the actionDataFilter
${ .collections.test }
didn't work and it only gave me an output like{ "test": "sth" }
.Expected behavior
The workflow should be
{ "collections": { "test": "sth" } }
.Actual behavior
{ "test": "sth" }
How to Reproduce?
actionDataFilter.toStateData
with a nested path likea.b
Output of
uname -a
orver
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
orgradlew --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
The text was updated successfully, but these errors were encountered: