Skip to content

Commit 8bd6011

Browse files
committed
Fix runtime type extraction
1 parent 7fe16d6 commit 8bd6011

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

temporalio/nexus/handler.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,16 @@ def workflow_run_operation(
323323
def factory(service: S) -> WorkflowRunOperation[I, O, S]:
324324
return WorkflowRunOperation(service, start_method)
325325

326-
setattr(
327-
factory,
328-
"__nexus_operation__",
329-
nexusrpc.handler.NexusOperationDefinition(name=start_method.__name__),
326+
type_annotations = typing.get_type_hints(start_method)
327+
[output_type] = typing.get_args(type_annotations.pop("return"))
328+
[input_type, _] = type_annotations.values()
329+
330+
factory.__nexus_operation__ = nexusrpc.handler.NexusOperationDefinition(
331+
name=start_method.__name__,
332+
input_type=input_type,
333+
output_type=output_type,
330334
)
335+
331336
return factory
332337

333338

0 commit comments

Comments
 (0)