This library defines a buf
custom plugin.
This plugin reads in a bunch of proto files, and for the RPC services generates some helpers: behaviour modules and "impl" modules to make calling and testing gRPC methods easier.
This repo is not intended to be used directly, but rather includes an escript
. This can be used as part of a shell script:
which protoc-gen-elixir-rpc || PATH="~/.mix/escripts:$PATH" && mix escript.install --force github surgeventures/elixir-rpc-proto-gen-helpers
Then you can use the plugin for buf generate
. An example buf
config file might be:
version: v1
plugins:
- name: elixir
strategy: all
out: ./lib/generated
opt: plugins=grpc
- name: elixir-rpc
strategy: all
out: ./lib/generated
opt: plugins=grpc
If available in Hex, the package can be installed
by adding rpc_proto_gen_helpers
to your list of dependencies in mix.exs
:
def deps do
[
{:rpc_proto_gen_helpers, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/rpc_proto_gen_helpers.