我試圖使用Google Cloud Endpoints來製作基於gRPC的API,可以transcode incoming REST requests。我正在關注their example code,但我無法通過任何關於如何正確導入和編譯annotation.proto或empty.proto的文檔。如何導入gRPC空白和Google API註釋原始
謝謝!
我試圖使用Google Cloud Endpoints來製作基於gRPC的API,可以transcode incoming REST requests。我正在關注their example code,但我無法通過任何關於如何正確導入和編譯annotation.proto或empty.proto的文檔。如何導入gRPC空白和Google API註釋原始
謝謝!
我不明白這是grpc-gateway的一部分。通過following the docs我跑
protoc -I/usr/local/include -I. -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=plugins=grpc:. *.proto
並編譯成功。
默認情況下不包含empty.proto和annotation.proto,因此您需要提供一份副本。具體而言,您可以在項目目錄中複製它們,或者在現有項目中引用它們(例如Protobuf git repo)。
這可能是一個好主意不是參考grpc-ecosystem/grpc-gateway使用的副本,因爲他們可能想在將來移動它。