Skip to content
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

Support Literal and Union/Optional types on structs. Fixes #405 #408

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

ptomecek
Copy link
Collaborator

@ptomecek ptomecek commented Dec 3, 2024

Fixes #405.
In particular, since the type annotations are preserved when calling .metadata(typed=True), they can then be used for runtime validation, which would not be the case if "str" (in the case of Literal) or object (in the case of Union) was used directly, Of course, by using Union one loses the benefits of being able to operate on the data in C++, but this is already true of "object", so the validation capabilities are a strict improvement.

@ptomecek ptomecek force-pushed the pit/literal branch 2 times, most recently from a174b05 to 43b9e0c Compare December 4, 2024 01:36
@ptomecek ptomecek marked this pull request as ready for review December 4, 2024 03:43
@timkpaine timkpaine added the type: bug Concrete, reproducible bugs label Dec 4, 2024
@ptomecek ptomecek merged commit ac07bd9 into main Dec 4, 2024
29 checks passed
@ptomecek ptomecek deleted the pit/literal branch December 4, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Concrete, reproducible bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

typing.Literal not supported as struct field type
3 participants