Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are protobuf messages compatible across versions of protobuf

I started building an app with protobuf 2.2.0 as it was the latest. Now I'm considering upgrading to protobuf 2.4.0a which is the latest. If I do so will the messages generated by one version of the app still be readable by the other version for the same schema? Or would I be breaking something?

like image 250
rahul Avatar asked Feb 10 '11 22:02

rahul


People also ask

Is protobuf backwards compatible?

Protocol buffers provide a language-neutral, platform-neutral, extensible mechanism for serializing structured data in a forward-compatible and backward-compatible way.

Is proto3 backwards compatible?

One of selling points of Protobuf was backward compatibility, i.e. developers can evolve format, and older clients can still use it. Now with new Protobuf version called proto3, the IDL language itself is not compatible as such things as options , required where dropped, new syntax for enuns, no extention.

Is oneof backwards compatible?

Moving existing fields into a oneof is a backward incompatible change, unless it is a new oneof with a single field.

Is proto3 backwards compatible with proto2?

The same construct in proto2 and proto3 will have the same binary representation. If your proto only uses features available in both proto2 and proto3, systems built with proto2 should be able to communicate with systems built with proto3 without any problem (it's also true vice versa).


1 Answers

That should be fine. Version 2.1.0 introduced packed repeated fields, but I don't believe there have been any wire format changes since then.

like image 121
Jon Skeet Avatar answered Oct 13 '22 21:10

Jon Skeet