-
-
Notifications
You must be signed in to change notification settings - Fork 794
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
skip_serializing_if is a footgun #1732
Comments
I think I would prefer not to build an additional toggle into the Serializer API for this. This is a subissue of a limitation that data structures which need to follow a different codepath for serializing to different formats are not well supported by serde. |
The lack of this feature causes problems when building serializable data structures to work with an arbitrary serializer. We have to feature-gate our code to disable |
What if |
Filed #2012 for that idea |
This continues to be a source of woe. |
skip_serializing_if
only works if the serialization format is self-describing. It does not work with e.g. bincode. This is a footgun in a codebase that uses more than one serialization format at different points, because I can addskip_serializing_if
to something that gets fed into the JSON serializer and it works fine, but when it gets fed into the bincode serializer it produces garbage that will fail to deserialize.I think the solution here is for Serializers to declare whether or not they support skipping things and then make
skip_serializing_if
only have an effect for serializers that can tolerate it.The text was updated successfully, but these errors were encountered: