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
6
votes
1 answer

Compile protobuf to use primitive classes instead of well-known types

Lets say I have test.proto file: syntax = "proto3"; option java_package = "testing"; option java_outer_classname = "Test_v1"; import "google/protobuf/wrappers.proto"; message TestMessage { .google.protobuf.Int32Value integerField = 1; } If I…
Renatas M.
  • 11,694
  • 1
  • 43
  • 62
6
votes
3 answers

Integrating gorm.Model fields into protobuf definitions

I am trying to figure out how to integrate the gorm.Model fields (deleted_at, create_at, id, etc) into my proto3 definitions. However, I can't a datetime type for proto3. I tried looking for documentation on how to serialize the gorm fields to…
Alex Luis Arias
  • 1,313
  • 1
  • 14
  • 27
6
votes
1 answer

How to support patch rest request with protobuf 3

We often have use cases where we only want to update a subset fields on a resource. So if we have a resource Person: type Person struct { Age int Name string Otherfield string } Say the calling client only wants to update the Age field.…
Dave
  • 1,645
  • 2
  • 23
  • 39
6
votes
1 answer

Test if ProtoBuf value is using default

I have a ProtoBuf object. I'd like to detect when a particular field is using the default, versus explicitly supplied. message vector_measurement { measurement x = 1; measurement y = 2; measurement z = 3; } ... message measurement { …
Phrogz
  • 296,393
  • 112
  • 651
  • 745
6
votes
2 answers

Dynamic parsing of .proto text file at runtime to generate descriptors

I am currently working on Google Protocol Buffers and need to generate dynamic messages. I already have my .proto files defined as shown below. message TSInbound { string id = 1; map state = 2; map reading…
Ankita
  • 2,798
  • 4
  • 18
  • 25
6
votes
1 answer

C# Google.ProtocolBuffers Deserialization Method (proto3)

I have recently upgraded my code base (Java, C++ and C#) to use proto3. In the case of C# this has involved over 2000 changes to the code. This is mostly semantic and all good, but there is one issue I can't seem to fathom;…
MoonKnight
  • 23,214
  • 40
  • 145
  • 277
5
votes
3 answers

How to add message type as object in ProtoBuf (gRPC) - Proto3 Syntax?

How to send message type as object in ProtoBuf - Proto3 Syntax? I want to transfer object instead of string or number. Example { name: 'One', date: 'date', some: 'some', ... ... } syntax = "proto3"; package db; service Proxy { rpc…
Aravin
  • 6,605
  • 5
  • 42
  • 58
5
votes
3 answers

Protobuf ignoring bool and ints values due to default

I am converting a json file to string and then the string is converted to proto3 file. Here is the json file: { "a": false, "b": 0 } Here is how I convert my json file to string: String json…
Manas Saxena
  • 2,171
  • 6
  • 39
  • 58
5
votes
2 answers

Can I set a maximum value for a number in protobuf?

In protobuf, we only have the choice of using signed or unsigned 32- or 64-bit integer to limit the range of a value. However, the datastructure I want to define contains a mixture of 8-bit, 16-bit and 32-bit integers to save space on embedded…
iFreilicht
  • 13,271
  • 9
  • 43
  • 74
5
votes
1 answer

Determine which 'oneof' proto3 field is set in C#

For the following Protocol Buffer message (proto3) how to I determine which type is set? There does not seem to be a "has_reply" method as is the case for the generated C++ version. message Event { oneof type { Connection connection = 1; …
kyrre
  • 626
  • 2
  • 9
  • 24
5
votes
5 answers

How to pass in json as payload in .proto

As per the following page I should be able to send in json payload : https://developers.google.com/protocol-buffers/docs/proto3 under 'JSON Mapping'. I would like to send in json payload as part of the message and I have the following .proto file…
user1860447
  • 1,316
  • 8
  • 25
  • 46
5
votes
1 answer

Protobuf backward compatibility and proto3 vs proto2

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,…
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
5
votes
1 answer

Proto3 setting value equal to default is not recognised in runtime

Proto3 is not as strict as Proto2, and there are no required or optional fields, there are no custom default values. Given the following definition... message Order { enum Side { BID = 0; ASK = 1; } int64 time = 1; …
vach
  • 10,571
  • 12
  • 68
  • 106
4
votes
0 answers

proto3 can't support isStringEmpty()

This is my .proto file syntax = "proto3"; package testing; option java_multiple_files = true; option java_package = "com.api.commons.proto"; option java_outer_classname = "SampleProto"; message Person { string name = 1; int32 id = 2; string…
Alex Sparrow
  • 197
  • 2
  • 7
4
votes
1 answer

Optional support in Proto3 for Go

Does optional supports in proto3 while working with Go? I tried with this: protoc person.proto --go_out=. --experimental_allow_proto3_optional but got this error person.proto: is a proto3 file that contains optional fields, but code generator…
Khushi
  • 39
  • 1
  • 5
1
2
3
9 10