LoginSignup
0
0

More than 5 years have passed since last update.

Google Protobuf - How to Define an Optional Field in Protobuf 3?

Last updated at Posted at 2019-01-08

Answer: In proto3, all fields are "optional".

import "google/protobuf/wrappers.proto";

message Foo {
    int32 bar = 1;
    google.protobuf.Int32Value baz = 2;
}
if(foo.hasBaz()) { ... }

https://matsu-chara.hatenablog.com/entry/2016/11/12/110000
https://tomasbasham.co.uk/development/2017/09/13/protocol-buffers-and-optional-values.html
https://stackoverflow.com/questions/42622015/how-to-define-an-optional-field-in-protobuf-3

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0