feat(prost-derive): skip field attribute #1339
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change will allow Prost users to skip a field during serialization and deserialization. It also provides an optional
default
attribute for these fields, in the event the underlying object does not implement theDefault
trait.My motivation for this is some reverse engineering effort, in which the existing datastructures are serialized in both protobuf and xml formats. I can use
quick_xml
/serde
and ignore protobuf-only fields, but I can't ignore xml-only fields usingprost
, which results in duplicate data structures and more boilerplate to convert between the two types.Usage:
Related: #174
This appears to work locally, but I can't get the full test suite to run (even with clean main branch). I'd like to add some integration tests for this, but it seems the only tests for derive currently are the existing Protobuf known-types (where this wouldn't really make sense), and a few negative test cases in the derive package.