Skip to content
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

Kotlin ActivityStubExt.execute* extension functions wrap arguments in list #2018

Open
rgrochowicz opened this issue Mar 26, 2024 · 1 comment

Comments

@rgrochowicz
Copy link

Expected Behavior

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

  1. Create a new ActivityStub via Workflow.newUntypedActivityStub
  2. Import the Kotlin extension method via import io.temporal.workflow.execute
  3. Call activityStub.execute<Void>("activityName", object { val foo = 1 })
  4. 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 (*).

Specifications

  • Version: Java SDK v1.23.0
  • Platform: macOS / Linux
@Quinn-With-Two-Ns
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants