Extending my own custom options

14 views
Skip to first unread message

Nadav Samet

unread,
Nov 14, 2020, 9:09:02 PM11/14/20
to Protocol Buffers
Hey there, I maintain a library (ScalaPB) that has its own custom options. I am working on a use case where additional libraries can augment ScalaPB custom options by extending them. I am not able to find a syntax that works with protoc so I wonder if this use case is supported. 

To make it more concrete, here's the scenario condensed to a single file:

syntax = "proto2";

import "google/protobuf/descriptor.proto";

message MyMessageOptions {
  optional int32 a = 1;
  extensions 50000 to max;
}

extend google.protobuf.MessageOptions {
  optional MyMessageOptions myopts = 50000;
}

extend MyMessageOptions {
  optional bool ext = 50001;
}

message TryIt {
  option (myopts).a   = 17;    // works
  option (myopts).ext = true;  // doesn't work
}


Is there a syntax to set the value of ext, or do I need the extensions-extensions to extend google.protobuf.MessageOptions directly?

--
-Nadav
Reply all
Reply to author
Forward
0 new messages