English | 中文
protoc-gen-triple-openapi is a protoc plugin that generates OpenAPI v3 documents from protobuf services used with the Dubbo Triple protocol.
- Go 1.23 or later
protoc- protobuf files that define Triple services
go install dubbo.apache.org/dubbo-go/v3/tools/protoc-gen-triple-openapi@latestMake sure $(go env GOPATH)/bin is in your PATH.
Generate YAML, the default format:
protoc \
--triple-openapi_out=. \
--triple-openapi_opt=format=yaml \
./api/greet.protoGenerate JSON:
protoc \
--triple-openapi_out=. \
--triple-openapi_opt=format=json \
./api/greet.protoGenerated file names use the input proto base name:
greet.triple.openapi.yamlgreet.triple.openapi.json
syntax = "proto3";
package org.apache.dubbo.samples.greet;
option go_package = "example.com/hello/api;api";
service GreetService {
rpc Greet(GreetRequest) returns (GreetResponse) {}
}
message GreetRequest {
string name = 1;
}
message GreetResponse {
string greeting = 1;
}| Option | Values | Default | Description |
|---|---|---|---|
format |
yaml, json |
yaml |
Output document format. |
protoc-gen-triple-openapi --version