We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Trying to use typical to serialize/deserialize a type that has a recursive field of type List:
List
@dataclasses.dataclass class Node: children: List["Node"] typic.transmute(Node, {"children": []}) # => raises RecursionError: maximum recursion depth exceeded
Tried using "List[Node]" as the type, and from __future__ import annotations:
"List[Node]"
from __future__ import annotations
@dataclasses.dataclass class Node: children: "List[Node]" typic.transmute(Node, {"children": []}) # => raises RecursionError: maximum recursion depth exceeded from __future__ import annotations @dataclasses.dataclass class Node: children: List[Node] typic.transmute(Node, {"children": []}) # => raises RecursionError: maximum recursion depth exceeded
With Optional instead of List, it seems to work:
Optional
@dataclasses.dataclass class Node: child: Optional["Node"] typic.transmute(Node, {"children": Node}) # => Node(child=None)
The text was updated successfully, but these errors were encountered:
fix(resolver): Recursive types nested within containers caused a recu…
087e348
…rsion error (#136)
seandstewart
Successfully merging a pull request may close this issue.
2.0.252.0.32Description
Trying to use typical to serialize/deserialize a type that has a recursive field of type
List
:What I Did
Tried using
"List[Node]"
as the type, andfrom __future__ import annotations
:With
Optional
instead ofList
, it seems to work:The text was updated successfully, but these errors were encountered: