Giter VIP home page Giter VIP logo

Comments (3)

neoeinstein avatar neoeinstein commented on August 22, 2024

google-api-proto doesn't produce JSON bindings (serde::Serialize/serde::Deserialize impls) for the types in that crate. This means that the foreign messages/enums won't have the expected impls available to enable JSON serialization/deserialization if included as fields in messages from your local protobuf definitions.

Some options are:

  • Generate the bindings for the Google API locally, rather than through the external crate. This would enable protoc-gen-prost-serde to generate the canonical JSON serializations for the whole API.
  • Don't directly depend on these foreign types in your local crate, and instead do a mapping where appropriate. This is a bit less fun and requires some boilerplate, but also removes your direct dependency on the representation of the message in the Google APIs.
  • Suggest a way to suppress the generation of serde::Serialize implementations on certain messages or files. This would need to be done in a way that pbjson would be able to support, as we largely delegate the generation of this process to their crate.

from protoc-gen-prost.

stephanos avatar stephanos commented on August 22, 2024

Thank you for your reply!
As a workaround, I've copied the proto files into my project. It's not great but unblocked me.

I think your comment is a great reference for folks who are stuck on the same issue, so I'll close the issue.

from protoc-gen-prost.

stephanos avatar stephanos commented on August 22, 2024

Out of curiosity, is having protoc-gen-prost generate code for external types such as google.rpc.Status not possible or not desirable? It would make the experience much smoother.

from protoc-gen-prost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.