Skip to content
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

🐛HttpRule is stated in unannotated_echo_service.yaml, but warning is still issued #1578

Closed
piengeng opened this issue Aug 10, 2020 · 6 comments

Comments

@piengeng
Copy link
Contributor

To Reproduce

using existing example/internal/proto/examplepb/
new content of grpc-gateway\examples\internal\proto\examplepb\compile.bat

@echo off

set PROTOC_INCLUDE=C:\bin\protoc\include
set GRPC_GATEWAY_INCLUDE=%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis

rem generate grpc and gateway code
protoc -I. -I%PROTOC_INCLUDE% -I%GRPC_GATEWAY_INCLUDE% ^
--go_out=plugins=grpc,paths=source_relative:. ^
--grpc-gateway_out=logtostderr=true,paths=source_relative,grpc_api_configuration=.\unannotated_echo_service.yaml:. ^
--swagger_out=logtostderr=true:. ^
.\unannotated_echo_service.proto
  1. execute grpc-gateway\examples\internal\proto\examplepb\compile.bat

Expected behavior

no warning or provide better solution/message to help solve the warning.

Actual Behavior

W0810 21:57:55.756626   61400 services.go:38] No HttpRule found for method: UnannotatedEchoService.Echo
W0810 21:57:55.780626   61400 services.go:38] No HttpRule found for method: UnannotatedEchoService.EchoBody
W0810 21:57:55.780626   61400 services.go:38] No HttpRule found for method: UnannotatedEchoService.EchoDelete

Your Environment

libprotoc 3.12.4
protoc-gen-grpc-gateway Version 1.14.6, commit 7988867, built at 2020-05-25T10:53:01Z
protoc-gen-swagger Version 1.14.6, commit 7988867, built at 2020-05-25T10:53:05Z
also tested on dev version of protoc-gen-grpc-gateway and protoc-gen-swagger
go1.14.7
windows 10

@johanbrandhorst
Copy link
Collaborator

cc @andrascz

@andrascz
Copy link
Contributor

andrascz commented Aug 12, 2020

@piengeng please check the generated swagger.json. I think it will be empty or at least does not contain any endpoints, because the swagger plugin was not provided with the grpc_api_configuration parameter. The following works for me:

protoc -I. -I%PROTOC_INCLUDE% -I%GRPC_GATEWAY_INCLUDE% ^
--go_out=plugins=grpc,paths=source_relative:. ^
--grpc-gateway_out=logtostderr=true,paths=source_relative,grpc_api_configuration=.\unannotated_echo_service.yaml:. ^
--swagger_out=logtostderr=true,grpc_api_configuration=.\unannotated_echo_service.yaml:. ^
.\unannotated_echo_service.proto

So in my opinion the warning is valid and fulfills its purpose.

@piengeng
Copy link
Contributor Author

@andrascz you're right, my bad, i missed out the grpc_api_configuration on swagger plugin, thank you for clarifying this for me. Thanks to you both.

@johanbrandhorst
Copy link
Collaborator

Happy to hear it was resolved. Do you think we could improve our documentation to prevent other users from making this mistake in the future? We'd love your input to help make it better for the next user 😃.

@piengeng
Copy link
Contributor Author

Actually, i was following the steps in the documentation (https://grpc-ecosystem.github.io/grpc-gateway/docs/grpcapiconfiguration.html), it didn't mentioned grpc_api_configuration option for the --swagger_out, i tried googling on why the W0810 but reached dead-end, so decided to just raise issue here with existing example, lol.

Not to mention, the google's doc (https://cloud.google.com/service-infrastructure/docs/service-management/reference/rpc/google.api#google.api.HttpRule) is a bit too confusing for me.

@johanbrandhorst
Copy link
Collaborator

Ah, sounds like we could improve this, would you be willing to contribute an update to the docs? This page is defined here: https://github.com/grpc-ecosystem/grpc-gateway/blob/master/docs/_docs/grpcapiconfiguration.md. Let me know if you need any help.

piengeng added a commit to piengeng/grpc-gateway that referenced this issue Aug 12, 2020
add `--swagger_out` reference to issue grpc-ecosystem#1578
johanbrandhorst added a commit that referenced this issue Aug 12, 2020
…on (#1588)

* add the optional swagger plugin 

add `--swagger_out` reference to issue #1578

* Update docs/_docs/grpcapiconfiguration.md

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants