Skip to content
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

Implement serde traits for tonic_types::Status #2059

Open
jzelinskie opened this issue Nov 21, 2024 · 0 comments
Open

Implement serde traits for tonic_types::Status #2059

jzelinskie opened this issue Nov 21, 2024 · 0 comments

Comments

@jzelinskie
Copy link

Feature Request

Crates

tonic_types

Motivation

I'm working with a gRPC API that uses both Well Known Types and Google's RPC types. I've setup the extern paths as such:

.google.protobuf=::pbjson_types
.google.rpc=::tonic_types

I'm trying to use protoc-gen-prost-serde, but it's failing to generate because some of the protobuf messages embed the Status type which does not implement deserialization. It's throwing this error:

the trait `Deserialize<'_>` is not implemented for `tonic_types::Status`

From what I've discovered, I can add a type attribute of #[derive(serde::Serialize)] to the types that I'm generating, but because I'm "linking" to the tonic_types library, I don't believe I can modify the Status type to support serialization without modifying upstream.

Proposal

Have a feature for enabling the dependency on serde in the tonic_types crate.
I'm not a regular Rust programmer these days, so I'm probably not the best source of ideas.

Alternatives

Would be super happy to hear any if I'm missing something!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant