Hi all,
I have a protoc ruby plugin that does some codegen. I have defined the following toy custom message option.
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions {
optional string custom = 600001;
}
message PingRequest {
option (custom) = "123";
}
Later in the plugin, we have the following piece of code that attempts to read the custom option above. `request` below is just an instance of "::Google::Protobuf::Compiler::CodeGeneratorRequest".
services = request.proto_file.flat_map do |file_desc|
file_desc = T.must(file_desc)
file_desc.message_type.map do |message_desc|
if message_desc.name == "PingRequest"
puts message_desc.options
end
end
end
Interesting enough, `message_desc.options` outputs <Google::Protobuf::MessageOptions: uninterpreted_option: []>. I wonder if this is expected, or do we have some other way to retrieve the custom option.
Thanks,
Sean