Skip to main content

Protocol Buffers

Generate .proto files with gRPC services included.

ProtoVisitor

Transport layerSource code

This visitor creates a .proto file for all @service interfaces using protoc-gen-go. This should be used in conjunction with a language specific wrapper generator (for example, GRPCVisitor for Go) to generate the boilerplate code.

Example

generates:
proto/service.proto:
module: 'https://deno.land/x/apex_codegen@v0.1.9/proto/mod.ts'
visitorClass: ProtoVisitor
config:
options:
go_package: github.com/apexlang/outputtest/proto
runAfter:
- command: |
protoc
--go_out=.
--go_opt=paths=source_relative
--go-grpc_out=.
--go-grpc_opt=paths=source_relative
proto/service.proto

Configuration

FieldDescription
optionsA map of option names to values to include
info

You can use runAfter to execute protoc after the .proto is generated which will fully generate all your boilerplate code.