Support package specifiers
WebDrake opened this issue · comments
The proto2 specification allows for imported data structures to be specified precisely using package specifiers, as described here:
https://developers.google.com/protocol-buffers/docs/proto#packages
However, dproto fails to handle package specifiers, emitting an undefined identifier
error. This makes it very difficult to have shared .proto
definition files between, say, a D app and a Java app (since protoc
will fail to compile for Java if the package specifiers are missing).
As an example, consider the two following .proto
files:
inner.proto
package innerproto;
message InnerMessage {
optional uint64 id = 1;
optional string message = 2;
}
outer.proto
import "inner.proto";
message OuterMessage {
optional uint64 id = 1;
optional innerproto.InnerMessage message1 = 2;
optional innerproto.InnerMessage message2 = 3;
}
If the innerproto.
package specifier is removed from outer.proto
, then protoc
will fail to compile it for Java. OTOH dproto will fail to handle outer.proto
if the package specifier is present.
@msoucy This feature would be great to correctly implement spec and interoperate with systems that use these; how much work would that be? Any pointers (eg what to change) would help!