You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Member variables of forward-referenced class types are ignored during serialization.
For example, consider the following case:
from __future__ import annotations
from dataclasses import dataclass
from mashumaro import DataClassDictMixin
@dataclass
class A(DataClassDictMixin):
a:B
@dataclass
class B(DataClassDictMixin):
b:int
a = A(B(1))
print(a.to_dict())
This gives us the expected:
{'a': {'b': 1}}
On the other hand, running the following case does not give the expected results.
@dataclass
class Base(DataClassDictMixin):
pass
@dataclass
class A1(Base):
a:B1
@dataclass
class B1(Base):
b:int
a = A1(B1(1))
print(a.to_dict())
Result:
{}
At this time, no exception or error message will be generated.
Expected:
{'a': {'b': 1}}
Thanks for the excellent tool!
The text was updated successfully, but these errors were encountered:
Member variables of forward-referenced class types are ignored during serialization.
For example, consider the following case:
This gives us the expected:
On the other hand, running the following case does not give the expected results.
Result:
At this time, no exception or error message will be generated.
Expected:
Thanks for the excellent tool!
The text was updated successfully, but these errors were encountered: