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
As per the comment for deserialize_bytes, it is expected that you can deserialize a non-UTF-8 string into a ByteBuf without failure. However, with flattened structures, deserialize_map is called in place of deserialize_struct (see serde-rs/serde#1529), meaning members are deserialized with deserialize_any bypassing deserialize_bytes. deserialize_any assumes values surrounded by quotation marks are valid UTF-8 strings and returns an error otherwise.
The text was updated successfully, but these errors were encountered:
scrblue
changed the title
Deserializing a flattened struct containing a ByteBuf fails to deserialize with UTF-8.
Deserializing a flattened struct containing a ByteBuf fails to deserialize with invalid UTF-8.
Jan 25, 2022
As reported in the issue I just mentioned this one in, deserialize_any is also used on all enums with tag directives meaning this deviation from expected results appears in multiple locations.
The fix you can make here would just be to ensure the deserialize_any function matches the functionality of the other deserialize_... functions. My PR to this crate will fix it in the case of deserializing into ByteBufs, but I'm not sure if other areas are affected as no other eccentricities have appeared in my use of serde and serde_json.
To fix this in Serde would likely require more fundamental changes that I don't have the expertise to make a PR for.
As per the comment for
deserialize_bytes
, it is expected that you can deserialize a non-UTF-8 string into aByteBuf
without failure. However, with flattened structures,deserialize_map
is called in place ofdeserialize_struct
(see serde-rs/serde#1529), meaning members are deserialized withdeserialize_any
bypassingdeserialize_bytes
.deserialize_any
assumes values surrounded by quotation marks are valid UTF-8 strings and returns an error otherwise.An example follows
The text was updated successfully, but these errors were encountered: