-
Notifications
You must be signed in to change notification settings - Fork 20
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
[BUG]: Incomplete Support for Union & NotRequired #121
Comments
@rnag here's the traceback to help investigation of point 2. I'm trying to understand what fix is needed but this get_parser_for_annotation function is complex. You can see from the traceback below that I am printing base type (I've inserted
|
@rnag are you able to take a look at this? is this project still maintained? |
Previously, annotating a `TypedDict` field with one of the `Required` and `NotRequired` wrappers introduced in Python 3.11, dataclass-wizard would raise the following error: > TypeError: issubclass() arg 1 must be a class Fix that error by adding support for `Required` and `NotRequired`. Partially addresses issue rnag#121. [1] [1]: rnag#121
Previously, annotating a `TypedDict` field with one of the `Required` and `NotRequired` wrappers introduced in Python 3.11, dataclass-wizard would raise the following error: > TypeError: issubclass() arg 1 must be a class Fix that error by adding support for `Required` and `NotRequired`. Partially addresses issue rnag#121. [1] [1]: rnag#121
Previously, annotating a `TypedDict` field with one of the `Required` and `NotRequired` wrappers introduced in Python 3.11, dataclass-wizard would raise the following error: > TypeError: issubclass() arg 1 must be a class Fix that error by adding support for `Required` and `NotRequired`. Partially addresses issue rnag#121. [1] [1]: rnag#121
Previously, annotating a `TypedDict` field with one of the `Required` and `NotRequired` wrappers introduced in Python 3.11, the library would raise the following error: > TypeError: issubclass() arg 1 must be a class Fix that error by adding support for `Required` and `NotRequired`. Partially addresses issue rnag#121. [1] [1]: rnag#121
Previously, annotating a `TypedDict` field with one of the `Required` and `NotRequired` wrappers introduced in Python 3.11, the library would raise the following error: > TypeError: issubclass() arg 1 must be a class Fix that error by adding support for `Required` and `NotRequired`. Partially addresses issue rnag#121. [1] [1]: rnag#121
Issues
There are 2 issues I've stumbled across when combining some semi-complex types:
Union[...]
orOptional
: You can't useX | Y
syntax < python3.10 withfrom __future__ import annotations
if the types are not simple. In my case, it was when I was using a TypedDict(...) | None. I got crazy syntax error with incomplete terminations. E.g.:Root cause suggestion from community member who helped me debug was:
Again, suggestion from community member:
"I think it has to due with the Union[..., None]; the Optional parser assumes the first argument does not need a custom parser"
The text was updated successfully, but these errors were encountered: