elixir-grpc / grpc

An Elixir implementation of gRPC
https://hex.pm/packages/grpc
Apache License 2.0
1.38k stars 212 forks source link

Google protobuf struct in include folder generation for elixir #278

Closed azzahidK closed 8 months ago

azzahidK commented 1 year ago

Description So I am trying to use grpc in elixir for calling from golang based grpc server using shared proto file. I realized that after doing the command below: protoc --proto_path=./<path-to-proto-folder>/ --elixir_out=plugins=grpc:./gen/grpc kargo-protobuff/company_service/*.proto

It doesn't automatically generate the google/struct.proto that is included in the $PROTO_PATH/include folder. And it caused an error.

Right now i am generating it manually but there is a need to move the include folder because there is a conflict when i try to generate it.

Question: Is there a way to generate the dependency in include folder automatically ?

polvalente commented 1 year ago

This seems like an issue with the upstream protobuf library.

Although perhaps @sleipnir or @wingyplus can help answer the question

wingyplus commented 1 year ago

As far as i know, the protobuf library doesn’t compile but just do only generate a type in your proto file. So you need to compile includes proto file by yourself.

In this case, you’re using google struct, you may use https://github.com/elixir-protobuf/google-protos which’s generated google probuffer code, you may need to use it as git dependency since it didn’t publish for a while.

sleipnir commented 1 year ago

As far as I know it's not possible to do that. You need to compile all dependencies individually. Only well-known types are automatically resolved.