Closed
Description
What are you really trying to do?
Use a dataclass as activity input with a field of type Literal["success", "failure"]
Describe the bug
When using the Literal type_hint, value_to_type shows an error
Unserializable type during conversion: typing.Literal['success', 'failure']
This seems to happen because temporal checks referential equality with Literal from typing_extensions, but typing_extensions doesnt reuse the one from typing unless 3.10+
Workaroundable by using Literal from typing_extensions, but this isnt documented. It would be nice if temporal just used the normal Literal from typing (and perhaps replicate the deduplication logic in 3.10+)
Minimal Reproduction
python3.9 -m venv venv
venv/bin/pip install temporalio
venv/bin/python
from temporalio.converter import value_to_type
from typing import *
value_to_type(Literal["a", "b"], "a")
Environment/Versions
- OS and processor: [e.g. M1 Mac, x86 Windows, Linux]
- Temporal Version: [e.g. 1.14.0?] and/or SDK version
- Are you using Docker or Kubernetes or building Temporal from source?