temporalio / sdk-go

Temporal Go SDK
https://docs.temporal.io/application-development?lang=go
MIT License
528 stars 210 forks source link

type ScheduleWorkflowAction(ScheduleClient) is expecting Args field value as []interface{} rather than interface{} #1153

Closed Praveen156 closed 1 year ago

Praveen156 commented 1 year ago

Expected Behavior

Hi, I am trying to pass arguments to Action field of ScheduleOptions type(Create Schedule method). I am expecting to pass args of any type of my choice, like it used to be in traditional workflow execution methods.

Actual Behavior

I am using the ScheduleWorkflowAction type to pass in the values to the Action field, where the Args field in ScheduleWorkflowAction is expecting []interface{}. I would like to know if it is intended to be this way, if it is then I would like to know if I should convert all my defined types to []interface and then pass it through.

Steps to Reproduce the Problem

Here is an Example payload that i have used client.ScheduleOptions{ Spec: client.ScheduleSpec{ CronExpressions: []string{"* * * * *"}, }, Action: &client.ScheduleWorkflowAction{ Workflow: SampleWorkflow, TaskQueue: "", Args: workflowArgs, }, }

I am expecting workflowArgs to be of any type that I define rather than to convert it into []interface{} everytime I decide to pass arguments.

MethodUsed - ScheduleClient.Create()

Reference Links

https://pkg.go.dev/go.temporal.io/sdk/internal#ScheduleWorkflowAction

Specifications

Quinn-With-Two-Ns commented 1 year ago

Yes it is expected. You should not need to convert any types, just pass your arguments in as a list

Praveen156 commented 1 year ago

Thanks @Quinn-With-Two-Ns

cretz commented 1 year ago

Also feel free to use forums or Slack for general questions.