protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

There's something wrong to get `.[...]` type

Open tdtadeu opened this issue 1 year ago • 1 comments

Hey everyone! First of all, thank you for this great lib! ❤️

I just came across this issue that literally asks me to contact the lib author, so here I am 🤣

I'm trying to use import public from a shared.proto file to aggregate multiple packages in one file; Then, in another proto, I import shared.proto and try to use one of the packages imported in it. As soon as I try to run protoc it gives me the error:

$ protoc --elixir_out=./lib ./**/*.proto
** (RuntimeError) There's something wrong to get .mypackage.arm_status.ArmStatus's type, please contact with the lib author.
    (protobuf 0.12.0) lib/protobuf/protoc/generator/util.ex:63: Protobuf.Protoc.Generator.Util.type_from_type_name/2
    (protobuf 0.12.0) lib/protobuf/protoc/generator/message.ex:136: Protobuf.Protoc.Generator.Message.get_field/4
    (protobuf 0.12.0) lib/protobuf/protoc/generator/message.ex:106: anonymous fn/5 in Protobuf.Protoc.Generator.Message.get_fields/2
    (elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (protobuf 0.12.0) lib/protobuf/protoc/generator/message.ex:106: Protobuf.Protoc.Generator.Message.get_fields/2
    (protobuf 0.12.0) lib/protobuf/protoc/generator/message.ex:32: Protobuf.Protoc.Generator.Message.generate/2
    (elixir 1.14.3) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (protobuf 0.12.0) lib/protobuf/protoc/generator/message.ex:24: Protobuf.Protoc.Generator.Message.generate_list/2
--elixir_out: protoc-gen-elixir: Plugin failed with status code 1.

I created an example project that you can use to reproduce the error here: https://github.com/tdtadeu/proto-error

And just for context, in case you wonder, the reason why I defined those enums in different files is because Protobuf won't allow me to use the same value for different enums (in my example, leg_status.proto and arm_status.proto both define values up, down and unknown).

I hope this is enough information, but if not please let me know how else I can help.

tdtadeu avatar May 04 '23 15:05 tdtadeu