proto3

Protobuf backward compatibility and proto3 vs proto2

给你一囗甜甜゛ 提交于 2019-12-06 07:49:56
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. Does it mean that using proto3 there's no way to produce binary that older proto2 would read/understand also? It is like you have to continue to use proto2. If you start using proto3, you can't talk to older systems, or have to rewrite, recompile all those .proto s That is compatibility

Protocol buffer3 and json

房东的猫 提交于 2019-12-03 12:45:39
问题 Protocol buffer v3 claims, that library is json friendly (https://developers.google.com/protocol-buffers/docs/proto3#json), but I cannot find how to achieve get that mapping. Should I add some plugin, or some option into protoc, or call something special instead SerializeTo/ParseFrom? Is it someone who use that feature? 回答1: I'm using Protobuf 3.3.0, which does have a built-in JSON serializer and parser. You can use 2 functions from google/protobuf/util/json_util.h called MessageToJsonString(

Why required and optional is removed in Protocol Buffers 3

不想你离开。 提交于 2019-11-27 16:45:29
I'm recently using gRPC with proto3 , and I've noticed that required and optional has been removed in new syntax. Would anyone kindly explain why required/optional are removed in proto3? Such kind of constraints just seem necessary to make definition robust. syntax proto2: message SearchRequest { required string query = 1; optional int32 page_number = 2; optional int32 result_per_page = 3; } syntax proto3: syntax = "proto3"; message SearchRequest { string query = 1; int32 page_number = 2; int32 result_per_page = 3; } The usefulness of required has been at the heart of many a debate and flame

Why required and optional is removed in Protocol Buffers 3

拈花ヽ惹草 提交于 2019-11-26 15:01:14
问题 I'm recently using gRPC with proto3 , and I've noticed that required and optional has been removed in new syntax. Would anyone kindly explain why required/optional are removed in proto3? Such kind of constraints just seem necessary to make definition robust. syntax proto2: message SearchRequest { required string query = 1; optional int32 page_number = 2; optional int32 result_per_page = 3; } syntax proto3: syntax = "proto3"; message SearchRequest { string query = 1; int32 page_number = 2;