media-io / yaserde

Yet Another Serializer/Deserializer
MIT License
175 stars 57 forks source link

Feature Request: Equvalent to serde's skip / skip_serializing skip_deserializing #131

Open amy-keibler opened 2 years ago

amy-keibler commented 2 years ago

Currently, yaserde supports skip_serializing_if for excluding fields for serialization. My use-case is that I want to use a Rust struct for both XML and JSON serialization/deserialization. For the most part, this works well. However, The JSON schema defines additional fields (format and version) that are the rough equivalent of the XML namespace. I want to be able to exclude those fields with #[yaserde(skip)] in the same way I'd write #[serde(skip)] to exclude them from the JSON.

Although my use-case is only for skipping both serialization and deserialization, I think it would be a good idea to copy serde's skip / skip_serializing / skip_deserializing, since that pattern will probably be the same amount of work and will already be familiar to consumers of serde.

amy-keibler commented 2 years ago

I am unfamiliar with yaserde's codebase, but I am interested in attempting to add this feature if anyone has any pointers on where best to get started.