nexusrpc.handler._util

Extract input and output type annotations from a start method.

Returns
A tuple of (input_type, output_type)
where
  • None means the type annotation is missing or could not be extracted. This is valid when a service definition provides the types.
  • type(None) (NoneType) means the annotation explicitly specified None as the type (e.g., input: None or -> None).

When None is returned for either type, the caller should handle it based on whether a service definition is available:

  • If a service definition is provided, the types from the service definition will be used and type validation against the handler is skipped.
  • If no service definition is provided, an error will be raised downstream when attempting to create an OperationDefinition.