grpc-ecosystem/grpc-gateway
protoc-gen-openapiv2: `go_package` option is required since version 2.0.1
オープン
#2,127 opened on 2021/05/06
bughelp wanted
Repository metrics
- Stars
- (16,971 個のスター)
- PR merge metrics
- (平均マージ 8d 23h) (30d で 147 merged PRs)
説明
🐛 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