News for hackers. Stuff that matters.
Re:Protobuf Editions are here: don't panic by rco8786 on Thursday May 09, 2024 @07:37PM (#40314038)
As if I couldn’t hate protobufs any more. They go and layer on yet more complexity.

These sorts of things need to be as simple as humanly possibly and get out of your way so you can actually do some programming. Instead protobufs are the opposite. Full of backwards compat issues, footguns, and needless complexity that make them an absolute horror to work with.

Re:Protobuf Editions are here: don't panic by drunner on Thursday May 09, 2024 @08:11PM (#40314254)
Do you have a preferred message protocol?
Re:Protobuf Editions are here: don't panic by VHRanger on Thursday May 09, 2024 @08:31PM (#40314356)
JSON with a good schema if you're doing it across languages?
Re:Protobuf Editions are here: don't panic by swatcoder on Thursday May 09, 2024 @08:37PM (#40314400)
XML, JSON, and YAML belong to a totally diffent class of use than protobuf, flatbuffers, capnproto, etc

It's like comparing apples and screwdrivers.

Re:Protobuf Editions are here: don't panic by hot_gril on Thursday May 09, 2024 @08:44PM (#40314442)
They're comparable for a lot of use cases. In fact many protobuf-based APIs will also have a JSON mode.
Re:Protobuf Editions are here: don't panic by swatcoder on Thursday May 09, 2024 @08:50PM (#40314469)
Exactly because the consumers of those API's exhibit a strong preference for one or the other.

Library/module/API developers often seek to deliver maximimum adaptibility in their interfaces so that consumers of them can satisfy their own more specific/pressing requirements.

Re:Protobuf Editions are here: don't panic by dilyevsky on Thursday May 09, 2024 @09:58PM (#40314840)
imo it's mainly because protos are unusable on the web without something like grpc-web (which requires a proxy) and in general web support in protobufs always seemed like an afterthought, just barely working (if at all) which is kind of ironic considering it came out of Google
Re:Protobuf Editions are here: don't panic by hot_gril on Friday May 10, 2024 @01:31AM (#40315743)
I've never used protobufs with web, but I don't see why not. gRPC, on the other hand, requires HTTP/2 which can be a luxury. I remember making a side project that uses gRPC a while ago and trying to deploy on GCP AppEngine, only to find out it doesn't support gRPC.
Re:Protobuf Editions are here: don't panic by dilyevsky on Friday May 10, 2024 @02:17AM (#40315905)
well if you can't use gRPC which, as you correctly notes, is protocol-incompatible with browser APIs, you kinda need to roll your own RPC framework. Various attempts had been made at this - see connectrpc, for example, by the same company that authored this post. imo, big advantage of protobuf/gRPC ecosystem is that Google is doing all the heavy lifting for you, so unless something else catches on with wider community it's going to be pretty risky beyond hobby projects.
Re:Protobuf Editions are here: don't panic by hot_gril on Friday May 10, 2024 @12:15PM (#40320676)
Yeah, that's why I wouldn't do it. Not totally unusable, but painful.
Re:Protobuf Editions are here: don't panic by rco8786 on Friday May 10, 2024 @06:59AM (#40317458)
> I've never used protobufs with web, but I don't see why not

We have a bunch of apis like this where I work. It's a huge pain, tbh. You lose the ability to just curl endpoints, or to see what data came over the wire for debugging, not to mention having to use esoteric client libs because every off-the-shelf one just assumes json over http.

Re:Protobuf Editions are here: don't panic by TillE on Thursday May 09, 2024 @08:48PM (#40314456)
I'm sure there's some great schema implementation that you can bolt onto JSON, but personally I have never seen anyone actually using one in the wild.

With protobuf the schema is essential, it is the foundation. I feel this is a huge advantage especially for communication protocols.

Re:Protobuf Editions are here: don't panic by VHRanger on Friday May 10, 2024 @07:05AM (#40317503)
We've used it. It's useful to define the contract between teams.

So you have 2 teams do a meeting, we work out a contract we like, dump that into a jsonschema and you can enforce by unit tests that schema is respected on each side (producer/consumer)

Re:Protobuf Editions are here: don't panic by sagarm on Thursday May 09, 2024 @08:42PM (#40314429)
JSON is the serialization format. What's the IDL?
Re:Protobuf Editions are here: don't panic by hot_gril on Thursday May 09, 2024 @08:45PM (#40314446)
I've seen OpenAPI/Swagger in the wild a few times. It's a good way to specify the API for an HTTP server, whether it's JSON or something else. Biggest downside is the confusing name change.