-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
protoc-gen-openapiv2 generates additional paths when API includes several services with resource name based paths #2489
Comments
Thanks for the issue! Do you think you could try and figure out when this was introduced? Is it a regression or something that has always been present? |
With 2.7.1, I get paths |
Thanks for confirming, that will make it easier to fix! |
@johanbrandhorst @oyvindwe I have raised a PR that should fix this: #2496 |
@aethanol I have tested your fix locally, and the additional paths are gone. Thank you very much for your effort! |
🐛 Bug Report
When specifying a gRPC API with multiple services with resource name based paths, and these services have multiple methods for these paths, extra paths are generated in the OpenAPI file; each service in the proto file gets one extra set of paths per method per number of services below with the same path.
To Reproduce
test/foo_api.proto
:Make sure you have
google/api/annotations.proto
andgoogle/api/http.proto
available in the include path.Generate the OpenAPIv2 file:
protoc -I . --go_out=. --go_opt=module=example.com/test --go-grpc_out=. --go-grpc_opt=module=example.com/test --openapiv2_out . test/foo_api.proto
(I originally encountered this issue using
allowMerge=true
, but it occurs with a single file containing multiple services as well.)Expected behavior
The file should only contain paths
/v1/{name}
and/v1/{name_1}
. Each path should only apply to one service.Actual Behavior
The resulting file contains three paths with get and delete operations, mixed between the two services (
responses
removed for readability):Your Environment
macOS: 12.0.1
protoc:
libprotoc 3.17.3
go:
go version go1.17.2 darwin/amd64
grpc-gateway: 2.7.2
The text was updated successfully, but these errors were encountered: