Questions tagged [proto3]

Protocol Buffers - Google's data interchange format

Google Protocol Buffers questions related to version 3 of the Protocol Buffer format should be tagged with this tag.

At this time proto3 is still in alpha stage.

About Versioning

When protobuf was initially opensourced it implemented Protocol Buffers language version 2 (aka proto2), which is why the version number started from v2.0.0. From v3.0.0, a new language version (proto3) is introduced while the old version (proto2) will continue to be supported.

146 questions
1
vote
1 answer

How to use oneof as a type in proto3?

Given a message that looks like this, message Event { required int32 event_id = 1; oneof EventType { FooEvent foo_event = 2; BarEvent bar_event = 3; BazEvent baz_event = 4; } } I want to define another map which…
Suhas .N
  • 21
  • 3
1
vote
1 answer

Should protoc v2.6.1 produce 'Expected "required", "optional", or "repeated".'

Using Ubuntu 16.04 and CMake, I'm trying to create a shared library from the protobuf files. CMakes protobuf_generate_cpp is producing PROTO_SRCS and PROTO_HDRS. I didn't have any google/protobuf/*.proto files on my system, so I downloaded 3.6.1 and…
Ender
  • 1,652
  • 2
  • 25
  • 50
1
vote
2 answers

proto3 encoding - struct vs marshaled struct

I wish to know if there could be any significant difference in terms of mem efficiency between marshaling a struct and marshaling a marshaled struct. Example: Assume we have a struct B with some fields. message B{...} The common…
gavra
  • 93
  • 1
  • 2
  • 11
1
vote
1 answer

How dynamically assign correct message to decode protocol buffer message?

Hi I have a data stream pipeline that works over "events". Those events are simple protocol buffer messages, say: message OrderCoffee { int32 id = 1; } message CancelOrder { int32 id = 1; } A client then serialize/encode those messages and…
Montenegrodr
  • 1,597
  • 1
  • 16
  • 30
1
vote
1 answer

How to define a *.proto file with variable payload length?

I try to write my first *.proto file. This is my try: syntax = "proto3"; package Message; message Message { string name = 1; string serial = 2; int32 command = 3; enum Status { GOOD = 0; BAD = 1; } Status…
selmaohneh
  • 553
  • 2
  • 17
1
vote
1 answer

why proto buffer no date data type?

I am using node, I am curious why proto buffer there is no date data type? I am using sequelizejs ORM which I define a date field: tranTime: DataTypes.DATE MYSQL database is save as DateTime. Which data type should I use? Anyone use datetime with…
Alvin
  • 8,219
  • 25
  • 96
  • 177
1
vote
2 answers

Protobuf 3 breaks contract additivity

I'm using Protobuf 3 along with gRPC in distributed environment ("microservices"). Due to lack of supporting not-set/missing values in Protobuf 3 I got the following issue related to contract additivity. Imagine I have Service A and couple of…
idntfy_m
  • 133
  • 1
  • 6
1
vote
0 answers

proto3 nested message creation error

message Action { int32 protocol_version = 1; int64 uid = 2; int64 object_uid = 3; ServiceType service_type = 4; int32 left_messages = 5; } message SendTo { extend Action { SendTo action = 1010; } } If I…
Sachin
  • 501
  • 10
  • 18
1
vote
0 answers

Building proto3 library in windows for C++

I've successfully generated .cc and .h files from a proto2 protobuf. I've also followed the directions at https://github.com/google/protobuf/tree/v2.6.1/vsprojects to create the lib to link against. I created a couple projects in visual studio and…
Jeff Lamb
  • 5,755
  • 4
  • 37
  • 54
1
vote
1 answer

Validate and override defaults during parsing stage

Using C# native package of 3.0.0-beta3 version, as per official documentation defaults are assigned during parsing stage and there is no way to distinguish whether value was not passed at all, for my purposes this is vital point since I wanted to do…
sll
  • 61,540
  • 22
  • 104
  • 156
1
vote
1 answer

Parsing RepeatedFields in proto3

A simple 'Person' object is parsed as Person person = new Person { Id = 1, Name = "Foo", Email = "foo@bar", Phones = { new Person.Types.PhoneNumber { Number =…
0
votes
0 answers

Defined proto enum types cannot generate corresponding enum classes after compilation [python]

I have defined two enums in common.proto as follows: syntax = "proto3"; package common; message ClientTypeEnum { enum ClientType { SMB = 0; BV_VL = 1; } }; enum ErrCode{ PayCenterErrorCode_SUCCESS = 0; …
jia Jimmy
  • 1,693
  • 2
  • 18
  • 38
0
votes
0 answers

`proto3-json-serializer` doesn't map protobuf messages to proto3 json objects properly

I'm trying to upgrade the protobufjs package version from 6.11.3 to 7.2.4. But I noticed that message serialization part is not worked properly with latest protobufjs version. I'm using npm package proto3-json-serializer(0.1.8) for the serialization…
peemi
  • 1
  • 1
0
votes
2 answers

Do we have Future Datatype in Protobuf

I am exploring on grpc My sample application fetches few records from Database + reads a file from S3(very small file) and returns the combined result. Since the file size is very less, i am not using streams. So, the service layer of my application…
Jeevi
  • 2,962
  • 6
  • 39
  • 60
0
votes
0 answers

Proto3 reusing field options

We are writing a lot of validation rules using protovalidate. Some of rules are custom rules writen with protovalidate's cel expressions. Are there any way to reuse field options with import ? For example, Normally we are using like below; message…
Rasit aydin
  • 419
  • 2
  • 6
  • 16