-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
MessagePackDecoder fails in dataclass complex case #252
Comments
In summary, this is a super edge case. @dataclass
class DC:
grid: Dict[str, List[Optional[Union[int, str, float, bool, Status, InnerDC]]]] = field(default_factory=lambda: {
'all_types': [InnerDC()],
}) |
You might be interested in how mashumaro is used in bytes, so let me give you a brief concept. encodepython val -> msgpack bytes -> protobuf literal decodeprotobuf literal -> msgpack bytes -> python val How we create codecs? (encoder and decoder)We will provide python type to encoder or decoder to serialize/deserialize it now, thank you for looking this, and feel free to ping me to collaborate, I'll try to reply it in 1 day <3 |
Sorry for the late response, I was on sort of vacation from open source. I'm sure this issue is related to unions with str and other basic types. As I mentioned here, we can expect a solution very soon. I ran your example with the modifications I made and it passed with the expected output at the end: DC(grid={'all_types': [InnerDC(max_depth=10, max_features='sqrt', n_estimators=100)]}) |
The fix is ready, will be in the next release. |
mashumaro version: 3.13.1
Python version: 3.12.4
Operating System: macOS Sonoma 14.3
Description
I'm a maintainer of Flyte, and I encountered an issue while using
mashumaro.codecs.msgpack
'sMessagePackDecoder
andMessagePackEncoder
. Specifically, theMessagePackDecoder
fails to handle a certain edge case.What I Did
In both cases, encoding works, but decoding with
MessagePackDecoder
fails.The text was updated successfully, but these errors were encountered: