protoc-gen-openapiv2: `go_package` option is required since version 2.0.1
#2.127 aberto em 6 de mai. de 2021
Métricas do repositório
- Stars
- (16.971 stars)
- Métricas de merge de PR
- (Mesclagem média 1d 4h) (141 fundiu PRs em 30d)
Description
🐛 Bug Report
Since version 2.0.1, the protobuf option go_package is required to generate the gateway or the OpenAPI schema.
To Reproduce
Using this .proto file:
syntax = "proto3";
package your.service.v1;
message StringMessage {
string value = 1;
}
service YourService {
rpc Echo(StringMessage) returns (StringMessage) {}
}
Running protoc like so:
protoc -I . --grpc-gateway_out ./output my_service.proto
The output is:
protoc-gen-grpc-gateway: unable to determine Go import path for "my_service.proto"
Please specify either:
• a "go_package" option in the .proto source file, or
• a "M" argument on the command line.
See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more information.
(The problem is the same with protoc-gen-openapiv2)
Expected behavior
The go_package option shouldn't be require, at least to produce the OpenAPI output since this value has no meaning for this generator.
Ideally, it wouldn't be required for generating the gateway as well since the gateway is meant to be a runnable binary and not linked against as code.
Actual Behavior
protoc-gen-grpc-gateway: unable to determine Go import path for "my_service.proto"
Please specify either:
• a "go_package" option in the .proto source file, or
• a "M" argument on the command line.
See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more information.
Your Environment
MacOS Catalina, gen-gateway and openapiv2 from 2.0.1 to 2.4.0 all exhibit the same behaviour
protoc --version
libprotoc 3.14.0