I'm writing a protoc plugin for 2.5.0. My plugin is in Python.
Given the following proto:
import "google/protobuf/descriptor.proto";
message Test {
extend google.protobuf.MessageOptions {
optional int custom_option = 50000;
}
message Nested {
option (custom_option) = 5;
}
}
If I want, I can compile this to Python. Then in my plugin I can import
that Test_pb2.py file and lookup the option:
var.options.Extensions[Test.custom_option]
This works fine. However, the problem I can't figure out is that I need to
design the plugin so it works with *any* input file with *any* declared
extension option. So I can't write my code as 'Test.custom_option' because
I don't know beforehand what options will be declared.
I can get the extension dynamically from the Descriptor.extension list.
But this is a FieldDescriptorProto and to look up the extension in
options.Extensions I need an 'extension handle'. I'm not sure what that is
or how to get it.
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.