HackerTrans
TopNewTrendsCommentsPastAskShowJobs

sudorandom

39 karmajoined hace 14 años
https://kmcd.dev

[ my public key: https://keybase.io/sudorandom; my proof: https://keybase.io/sudorandom/sigs/lhEkaUpV37r7QzVea_cLcElODrYrTIMZezP1qIJjCro ]

Submissions

gRPC: 5 Years Later, Is It Still Worth It?

kostyay.com
69 points·by sudorandom·hace 2 años·33 comments

comments

sudorandom
·anteayer·discuss
The buf CLI can do this.

Here's how it looks to convert from encoded protobuf to json (protojson).

  buf convert schema.proto \
    --type YourMessageName \
    --from payload.binpb \
    --to output.json
And just invert the arguments to convert back.

  buf convert schema.proto \
    --type YourMessageName \
    --from data.json \
    --to encoded.binpb
sudorandom
·hace 2 años·discuss
You should really check out ConnectRPC. Out of the box it supports gRPC, gRPC-Web and a much more reasonable protocol called Connect without an extra middleware to do translation between gRPC/gRPC-Web. Plus, their typescript support is very well supported and there is a library exposing a Tanstack Query wrapper.
sudorandom
·hace 2 años·discuss
They are the protobuf descriptors, which is basically the protobuf encoded version of the protobuf files. They can be optional and many plugins have options to exclude that part from the generated code. Generally, they're useful for the Server Reflection feature of gRPC and it's used for runtime reflection.

Here's a more complete description of what they are and how they're used: https://buf.build/docs/reference/descriptors.