View Source mix protobuf.generate (protobuf_generate v0.1.3)
Generate Elixir code from .proto
files.
arguments
Arguments
file
- One or more.proto
files to compile
required-options
Required options
--output-path
- Path to output directory
optional-options
Optional options
--include-path
- Specify the directory in which to search for imports. Eqvivalent toprotoc
-I
flag.--tranform-module
- Module to do custom encoding/decoding for messages. SeeProtobuf.TransformModule
for details.--package-prefix
- Prefix generated Elixir modules. For example prefix modules with:MyApp.Protos
use--package-prefix=my_app.protos
.--generate-descriptors
- Includes raw descriptors in the generated modules--one-file-per-module
- Changes the way files are generated into directories. This option creates a file for each generated Elixir module.--include-documentation
- Controls visibility of documentation of the generated modules. Settingtrue
will not have@moduleoc false
--plugin
- If you write services in protobuf, you can generate gRPC code by passing--plugin=grpc
.
examples
Examples
$ mix protobuf.generate --output-path=./lib --include-path=./priv/protos helloworld.proto
$ mix protobuf.generate --include-path=priv/proto --include-path=deps/googleapis --generate-descriptors=true --output-path=./lib --plugin=ProtobufGenerate.Plugins.GRPC
google/api/annotations.proto google/api/http.proto helloworld.proto