Accessing Custom Options from .desc file

39 views
Skip to first unread message

vignesh suresh

unread,
Dec 18, 2022, 8:52:04 AM12/18/22
to Protocol Buffers
I have a proto with the following definitions.

import "google/protobuf/descriptor.proto"; 

extend google.protobuf.FieldOptions{ 
  optional bool is_key = 50002; 
}

message Foo{ 
  int64 id = 1 [(is_key) = true];
 }

I generated a .desc file for the above. I was able to access all the Fields and Message defined by the FieldDescriptorProto and DescriptorProto types but not sure how to access the options defined and the value provided to it in this case is_key.

is there a java version that could access the field options from the .desc file

Deanna Garcia

unread,
Dec 27, 2022, 4:00:34 PM12/27/22
to Protocol Buffers
I think you want to use the FileDescriptorProto, specifically it's options field.
Reply all
Reply to author
Forward
0 new messages