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
Although it is clear why the empty dict is being encoded, it is still desirable to avoid that, given that decoding absent fields does not cause any errors when the empty constructor (i.e. empty dict) is producing the expected default.
It would seem that recursive check with matches_default on subclasses of msgspec.Struct might do the job, but this would probably mean some hit on perfomance (?).
Perhaps there is a way to check the resulting '{}' value and omit it instead?
Thank you for considering this.
The text was updated successfully, but these errors were encountered:
Description
The following code:
Will output:
Although it is clear why the empty dict is being encoded, it is still desirable to avoid that, given that decoding absent fields does not cause any errors when the empty constructor (i.e. empty dict) is producing the expected default.
It would seem that recursive check with
matches_default
on subclasses ofmsgspec.Struct
might do the job, but this would probably mean some hit on perfomance (?).Perhaps there is a way to check the resulting
'{}'
value and omit it instead?Thank you for considering this.
The text was updated successfully, but these errors were encountered: