how does encoding of custom fieldoptions work

16 views
Skip to first unread message

LakshmiKanth Gupta

unread,
Dec 8, 2019, 11:15:17 AM12/8/19
to Protocol Buffers
syntax="proto3";
import "google/protobuf/descriptor.proto"
extend google.protobuf.FieldOptions{
   bool presence=50001;
}

message Mymessage
{
    int32 foo=1[(presence)=true];
    string bar=2;
}


I wrote following code and encoded:

Mymessage l_message;
l_message.set_foo(1);
l_message.set_bar("hello");

When I encoded it using l_message.SerializeToString(), the encoded payload doesn't have field options. Am I missing something? Please help.

What will be payload with custom field options encoded?
Reply all
Reply to author
Forward
0 new messages