This repository contains Protocol Buffer (protobuf) definitions for the Mrsool backend services.
- buf - Protobuf toolchain
- Go - For Go code generation
- Ruby - For Ruby code generation
- rbenv - Ruby version manager (recommended)
-
Setup the development environment:
make setup
-
Generate code for all languages:
make generate
-
Generate code for specific languages:
make generate-go # Generate Go code only make generate-ruby # Generate Ruby code only
make generate- Generate Go and Ruby code from protobuf definitionsmake generate-go- Generate Go code onlymake generate-ruby- Generate Ruby code onlymake lint- Run protobuf lintingmake breaking- Check for breaking changes against main branchmake clean- Remove generated codemake setup- Install required dependencies
mrsool-protos/
├── commons/ # Shared protobuf definitions
│ └── v1/
│ └── hello.proto
├── mrsool_backend/ # Mrsool backend specific protos
├── laas_backend/ # LaaS backend specific protos
├── dispatcher/ # Dispatcher specific protos
├── gen/ # Generated code (created by make generate)
│ ├── go/ # Generated Go code
│ └── ruby/ # Generated Ruby code
├── scripts/ # Build scripts
├── buf.yaml # Buf configuration
├── buf.gen.yaml # Code generation configuration
└── Makefile # Build automation
- Create your
.protofile in the appropriate directory - Use the correct package name and go_package option
- Run
make generateto generate code - Run
make lintto check for issues
syntax = "proto3";
package yourservice.v1;
option go_package = "github.com/mrsool/protos/gen/go/yourservice/v1;yourservicev1";
service YourService {
rpc YourMethod (YourRequest) returns (YourResponse) {}
}
message YourRequest {
string field = 1;
}
message YourResponse {
string result = 1;
}Run make setup to install the required protoc plugins.
The Makefile automatically sets up the PATH for protoc plugins. If you're running commands directly, make sure your PATH includes:
$HOME/go/bin(for Go plugins)$HOME/.rbenv/shims(for Ruby plugins)
Use make breaking to check for breaking changes before committing. This compares against the main branch.