When I use the ActivityStubExt.execute extension function, I expect the args parameter to be given as-is to the underlying ActivityStub.execute method (keeping the varargs intact).
Actual Behavior
The varargs args parameters to ActivityStubExt.execute is wrapped in a list rather than provided as a varargs parameter to ActivityStub.execute.
Steps to Reproduce the Problem
Create a new ActivityStub via Workflow.newUntypedActivityStub
Import the Kotlin extension method via import io.temporal.workflow.execute
Call activityStub.execute<Void>("activityName", object { val foo = 1 })
Observe that the arguments were wrapped in a list rather than given directly to ActivityStub.execute
More complete example:
import io.temporal.workflow.execute
import io.temporal.activity.ActivityOptions
// ... within workflow ...
val activityStub = Workflow.newUntypedActivityStub(ActivityOptions {})
activityStub.execute("activityName", object { val foo = 1 })
The ActivityTaskScheduled event has an input of:
[
[
{
"foo": 1
}
]
]
Rather than:
[
{
"foo": 1
}
]
The incorrect input is wrapped in an extra list.
To fix, I suspect that the call to ActivityStub.execute with varargs in ActivityStubExt.kt needs to use the spread operator (*).
Yes I think we are missing a spread operator, thank you for reporting this. I will follow up with my team and consider if there are any backwards compatibility issues with fixing this.
Expected Behavior
When I use the
ActivityStubExt.execute
extension function, I expect theargs
parameter to be given as-is to the underlyingActivityStub.execute
method (keeping the varargs intact).Actual Behavior
The varargs
args
parameters toActivityStubExt.execute
is wrapped in a list rather than provided as a varargs parameter toActivityStub.execute
.Steps to Reproduce the Problem
Workflow.newUntypedActivityStub
import io.temporal.workflow.execute
activityStub.execute<Void>("activityName", object { val foo = 1 })
ActivityStub.execute
More complete example:
The
ActivityTaskScheduled
event has an input of:Rather than:
The incorrect input is wrapped in an extra list.
To fix, I suspect that the call to
ActivityStub.execute
with varargs in ActivityStubExt.kt needs to use the spread operator (*
).Specifications