single file with grpc annotations for multiple services don't work
Author: gvencadzeCreated Dec 12, 2022Updated Jul 24, 2026
Labelsbughelp wantedopenapi
Bug Report
If you have yaml file with grpc annotations which contains selectors for multiple services, it'll raise an error if you try to generate code.
Previously discussed at slack: https://gophers.slack.com/archives/CBATURP1D/p1670838671867599
File structure scheme:
project
└───proto
└───api
└───first_svc
│ └───v1
│ └───first_svc.proto
└───second_svc
│ └───v1
│ └───second_svc.proto
│
│
└─── grpc_annotations.yamlgrpc_annotations.yaml content:
type: google.api.Service
config_version: 3
http:
rules:
### First service ###
- selector: api.first_svc.v1.FirstService.Get
get: /api/v1/first/get
### Second service ###
- selector: api.second_svc.v1.SecondService.Get
get: /api/v2/second/getTo Reproduce
- Create multiple proto services
- Add yaml file with grpc configuration which contains selectors for this services
- Try to generate (I'm using buf)
Expected behavior
I'm expecting to see generated code without errors
Actual Behavior
I'm getting error:
Failure: plugin grpc-gateway: HTTP rules without a matching selector:But If there will be single service and file with annotations will be located at the same path - everything will be okay
Your Environment
| instrument | version |
|---|---|
| OS | macOS 12 |
| Go | 1.19.3 darwin/arm64 |
| protoc-gen-grpc-gateway | v2.16.0 |
| protoc-gen-openapiv2 | v2.16.0 |
| buf | v1.9.0 |
Source: grpc-ecosystem/grpc-gateway