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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
protoc-gen-grpc-gateway: Error if identical annotations are provided #1865
Comments
I think the generator should error if you have two endpoints with identical annotations, though I'm not sure if we have a test for this. Have you tried it? |
I tried it, and it didn't give an error |
Alright, we should probably make the generator error in that case. If you'd like to contribute, the first step would be to add a new test that fails under the existing behavior. It should be possible to copy and adapt one of the tests in https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-grpc-gateway/internal/gengateway/template_test.go to reproduce this bug. Once we have a failing test, it should be easy to add some logic to check for duplicates and confirm that it works by running the test. Let me know if I can do anything more to help get you started. |
Hi @johanbrandhorst I'd like to tackle this issue, and I'd looked into it. I added a failing test to |
Hi Dane, thank you so much for picking up this issue! If you could create a pull request with your proposed changes it would be easier for me to review, but preliminarily your suggestion sounds OK, that we'll need some way to check duplicate annotations across all input files. Passing in using explicit parameters is almost always better than using a global. |
Raised a PR here for fixing this. Let me know what you think. |
馃摎 Documentation/Question
Is there any detection mechanism to check for duplicates of the corresponding RESTful URIs when I generate the Grpc-gateway files?
The text was updated successfully, but these errors were encountered: