@@ -221,6 +221,10 @@ def operator_service
221221 # @param versioning_override [VersioningOverride, nil] Override the version of the workflow.
222222 # This is currently experimental.
223223 # @param priority [Priority] Priority of the workflow. This is currently experimental.
224+ # @param arg_hints [Array<Object>, nil] Overrides converter hints for arguments if any. If unset/nil and the
225+ # workflow definition has arg hints, those are used by default.
226+ # @param result_hint [Object, nil] Overrides converter hint for result if any. If unset/nil and the workflow
227+ # definition has result hint, it is used by default.
224228 # @param rpc_options [RPCOptions, nil] Advanced RPC options.
225229 #
226230 # @return [WorkflowHandle] A workflow handle to the started workflow.
@@ -246,10 +250,15 @@ def start_workflow(
246250 request_eager_start : false ,
247251 versioning_override : nil ,
248252 priority : Priority . default ,
253+ arg_hints : nil ,
254+ result_hint : nil ,
249255 rpc_options : nil
250256 )
257+ # Take hints from definition if there is a definition
258+ workflow , defn_arg_hints , defn_result_hint =
259+ Workflow ::Definition . _workflow_type_and_hints_from_workflow_parameter ( workflow )
251260 @impl . start_workflow ( Interceptor ::StartWorkflowInput . new (
252- workflow : Workflow :: Definition . _workflow_type_from_workflow_parameter ( workflow ) ,
261+ workflow :,
253262 args :,
254263 workflow_id : id ,
255264 task_queue :,
@@ -269,6 +278,8 @@ def start_workflow(
269278 headers : { } ,
270279 versioning_override :,
271280 priority :,
281+ arg_hints : arg_hints || defn_arg_hints ,
282+ result_hint : result_hint || defn_result_hint ,
272283 rpc_options :
273284 ) )
274285 end
@@ -304,6 +315,10 @@ def start_workflow(
304315 # @param versioning_override [VersioningOverride, nil] Override the version of the workflow.
305316 # This is currently experimental.
306317 # @param priority [Priority] Priority for the workflow. This is currently experimental.
318+ # @param arg_hints [Array<Object>, nil] Overrides converter hints for arguments if any. If unset/nil and the
319+ # workflow definition has arg hints, those are used by default.
320+ # @param result_hint [Object, nil] Overrides converter hint for result if any. If unset/nil and the workflow
321+ # definition has result hint, it is used by default.
307322 # @param rpc_options [RPCOptions, nil] Advanced RPC options.
308323 #
309324 # @return [Object] Successful result of the workflow.
@@ -330,10 +345,11 @@ def execute_workflow(
330345 request_eager_start : false ,
331346 versioning_override : nil ,
332347 priority : Priority . default ,
333- follow_runs : true ,
348+ arg_hints : nil ,
349+ result_hint : nil ,
334350 rpc_options : nil
335351 )
336- handle = start_workflow (
352+ start_workflow (
337353 workflow ,
338354 *args ,
339355 id :,
@@ -353,9 +369,10 @@ def execute_workflow(
353369 request_eager_start :,
354370 versioning_override :,
355371 priority :,
372+ arg_hints :,
373+ result_hint :,
356374 rpc_options :
357- )
358- follow_runs ? handle . result : handle
375+ ) . result
359376 end
360377
361378 # Get a workflow handle to an existing workflow by its ID.
@@ -365,14 +382,18 @@ def execute_workflow(
365382 # interactions occur on the latest of the workflow ID.
366383 # @param first_execution_run_id [String, nil] First execution run ID used for some calls like cancellation and
367384 # termination to ensure the affected workflow is only within the same chain as this given run ID.
385+ # @param result_hint [Object, nil] Converter hint for the workflow's result.
368386 #
369387 # @return [WorkflowHandle] The workflow handle.
370388 def workflow_handle (
371389 workflow_id ,
372390 run_id : nil ,
373- first_execution_run_id : nil
391+ first_execution_run_id : nil ,
392+ result_hint : nil
374393 )
375- WorkflowHandle . new ( client : self , id : workflow_id , run_id :, result_run_id : run_id , first_execution_run_id :)
394+ WorkflowHandle . new (
395+ client : self , id : workflow_id , run_id :, result_run_id : run_id , first_execution_run_id :, result_hint :
396+ )
376397 end
377398
378399 # Start an update, possibly starting the workflow at the same time if it doesn't exist (depending upon ID conflict
@@ -386,6 +407,10 @@ def workflow_handle(
386407 # @param wait_for_stage [WorkflowUpdateWaitStage] Required stage to wait until returning. ADMITTED is not
387408 # currently supported. See https://docs.temporal.io/workflows#update for more details.
388409 # @param id [String] ID of the update.
410+ # @param arg_hints [Array<Object>, nil] Overrides converter hints for update arguments if any. If unset/nil and the
411+ # update definition has arg hints, those are used by default.
412+ # @param result_hint [Object, nil] Overrides converter hint for update result if any. If unset/nil and the update
413+ # definition has result hint, it is used by default.
389414 # @param rpc_options [RPCOptions, nil] Advanced RPC options.
390415 #
391416 # @return [WorkflowUpdateHandle] The update handle.
@@ -399,15 +424,20 @@ def start_update_with_start_workflow(
399424 start_workflow_operation :,
400425 wait_for_stage :,
401426 id : SecureRandom . uuid ,
427+ arg_hints : nil ,
428+ result_hint : nil ,
402429 rpc_options : nil
403430 )
431+ update , defn_arg_hints , defn_result_hint = Workflow ::Definition ::Update . _name_and_hints_from_parameter ( update )
404432 @impl . start_update_with_start_workflow (
405433 Interceptor ::StartUpdateWithStartWorkflowInput . new (
406434 update_id : id ,
407- update : Workflow :: Definition :: Update . _name_from_parameter ( update ) ,
435+ update :,
408436 args :,
409437 wait_for_stage :,
410438 start_workflow_operation :,
439+ arg_hints : arg_hints || defn_arg_hints ,
440+ result_hint : result_hint || defn_result_hint ,
411441 headers : { } ,
412442 rpc_options :
413443 )
@@ -423,6 +453,10 @@ def start_update_with_start_workflow(
423453 # @param start_workflow_operation [WithStartWorkflowOperation] Required with-start workflow operation. This must
424454 # have an `id_conflict_policy` set.
425455 # @param id [String] ID of the update.
456+ # @param arg_hints [Array<Object>, nil] Overrides converter hints for update arguments if any. If unset/nil and the
457+ # update definition has arg hints, those are used by default.
458+ # @param result_hint [Object, nil] Overrides converter hint for update result if any. If unset/nil and the update
459+ # definition has result hint, it is used by default.
426460 # @param rpc_options [RPCOptions, nil] Advanced RPC options.
427461 #
428462 # @return [Object] Successful update result.
@@ -436,6 +470,8 @@ def execute_update_with_start_workflow(
436470 *args ,
437471 start_workflow_operation :,
438472 id : SecureRandom . uuid ,
473+ arg_hints : nil ,
474+ result_hint : nil ,
439475 rpc_options : nil
440476 )
441477 start_update_with_start_workflow (
@@ -444,6 +480,8 @@ def execute_update_with_start_workflow(
444480 start_workflow_operation :,
445481 wait_for_stage : WorkflowUpdateWaitStage ::COMPLETED ,
446482 id :,
483+ arg_hints :,
484+ result_hint :,
447485 rpc_options :
448486 ) . result
449487 end
@@ -454,6 +492,8 @@ def execute_update_with_start_workflow(
454492 # @param args [Array<Object>] Signal arguments.
455493 # @param start_workflow_operation [WithStartWorkflowOperation] Required with-start workflow operation. This may not
456494 # support all `id_conflict_policy` options.
495+ # @param arg_hints [Array<Object>, nil] Overrides converter hints for signal arguments if any. If unset/nil and the
496+ # signal definition has arg hints, those are used by default.
457497 # @param rpc_options [RPCOptions, nil] Advanced RPC options.
458498 #
459499 # @return [WorkflowHandle] A workflow handle to the workflow.
@@ -463,13 +503,16 @@ def signal_with_start_workflow(
463503 signal ,
464504 *args ,
465505 start_workflow_operation :,
506+ arg_hints : nil ,
466507 rpc_options : nil
467508 )
509+ signal , defn_arg_hints = Workflow ::Definition ::Signal . _name_and_hints_from_parameter ( signal )
468510 @impl . signal_with_start_workflow (
469511 Interceptor ::SignalWithStartWorkflowInput . new (
470- signal : Workflow :: Definition :: Signal . _name_from_parameter ( signal ) ,
512+ signal :,
471513 args :,
472514 start_workflow_operation :,
515+ arg_hints : arg_hints || defn_arg_hints ,
473516 rpc_options :
474517 )
475518 )
0 commit comments