segfault87 / prost-serde-derive

Procedural macro to derive Serde serializer-deserializer for Prost
MIT License
5 stars 1 forks source link

prost-serde-derive

prost-serde-derive is a procedural macro to generate Serde serializers and deserializers for Prost-generated structs.

Rationale

Currently Prost does not support JSON serialization-deserialization. Although we have the almighty Serde for JSON serialization and deserialization, using serde_derive is not possible for Prost-generated structs because representation of enumerations is different between Prost structs and Protobuf-JSON format. Prost structs represent enumerations as plain integers but Protobuf-JSON represents as text identifiers so using serde_derive won't work. This procedural macro is intended to fix the issue.

Usage

In order to use, you need a Git master branch of prost-build which implements required methods for Prost enumerations for now. If you're using tonic_build, there is a fork for using Git version of prost-build.

To see it in action, see example crate.

TODO