prost-serde-derive is a procedural macro for serializing/deserializing structs generated by Prost with Serde.
How to use
When using tonic-build, add type attribute to the structs/enums like following:
fn main() {
tonic_build::configure()
.type_attribute("some.proto.SomeStruct", "#[derive(prost_serde_derive::Deserialize, prost_serde_derive::Serialize)]")
.type_attribute("some.proto.SomeStruct", "#[prost_serde_derive(use_default_for_missing_fields)]")
.type_attribute("some.proto.SomeStruct", "#[prost_serde_derive(omit_type_errors)]")
.type_attribute("some.proto.SomeEnum", "#[derive(prost_serde_derive::Deserialize, prost_serde_derive::Serialize)]")
.compile(...);
}
Make sure to include base64 to your dependencies when bytes type is used in your proto.