Convert protoc to Prototool.yaml

459 Views Asked by At

How do i convert protoc command to prototool.yaml file ?

protoc --proto_path=api/proto/v1 --proto_path=third_party --go_out=plugins=grpc:pkg/api/v1 todo-service.proto
protoc --proto_path=api/proto/v1 --proto_path=third_party --grpc-gateway_out=logtostderr=true:pkg/api/v1 todo-service.proto
protoc --proto_path=api/proto/v1 --proto_path=third_party --swagger_out=logtostderr=true:api/swagger/v1 todo-service.proto
1

There are 1 best solutions below

0
On

with the old swagger name in the grpc-gateway, you should be able to do something like:

//old name
    - name: swagger
      type: gogo
      flags: logtostderr=true,grpc_api_configuration=path/to/router.yaml
      output: .
//new name
    - name: openapiv2
      type: gogo
      flags: logtostderr=true,grpc_api_configuration=path/to/router.yaml
      output: .

all options can be found in https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-openapiv2/main.go