Import and use different package files in protobuf?

I imported a different proto that has a different package name than mine. To use messages from another package, you have access to this message with the package name.

Example:

other.proto

package muthu.other;

message Other{
   required float val = 1;
}

myproto.proto

package muthu.test;

import "other.proto";

message MyProto{
  required string str = 1;
  optional muthu.other.Other.val = 2;
}

Is there a way to use the package val muthu.other directly as an optional val = 2; instead of using muthu.other.Other.val ?

Could not find any help document. Help me.

+4
source share
1 answer

, , . muthu.test , "package muthu.other", .

Google protobuf:

.proto, .

package foo.bar;
message Open { ... }

:

message Foo {
  ...
  required foo.bar.Open open = 1;
  ...
}
+2

Source: https://habr.com/ru/post/1647986/


All Articles