Skip to content

Fixed serialization of typing.Literal #867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 14, 2025

Conversation

maciejdudko
Copy link
Contributor

What was changed

Fixed the converter so that both typing.Literal and typing_extensions.Literal type hints are handled correctly. Previously only typing_extensions.Literal worked as expected.

Checklist

  1. Closes [Bug] Serializing Literal fails #852

  2. How was this tested:

tests/test_converter.py::test_json_type_hints was updated with new checks.

  1. Any docs updates needed?

No

@maciejdudko maciejdudko requested a review from a team as a code owner May 14, 2025 15:20
@@ -23,6 +23,7 @@
ClassVar,
Dict,
List,
Literal,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that typing.Literal is present in 3.8+ so it is safe for use in all versions we currently support (it wasn't present in the oldest supported Python version when we first developed this)

@maciejdudko maciejdudko merged commit b0aae9b into temporalio:main May 14, 2025
14 checks passed
@maciejdudko maciejdudko deleted the typing-literal-serialization branch May 14, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Serializing Literal fails
2 participants