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

Emit error on HTTP rules without a matching selector and log warning on unbound methods #1178

Merged
merged 2 commits into from
Mar 17, 2020
Merged

Emit error on HTTP rules without a matching selector and log warning on unbound methods #1178

merged 2 commits into from
Mar 17, 2020

Conversation

andrascz
Copy link
Contributor

@andrascz andrascz commented Mar 17, 2020

Fixes #1175

I could not emit error in case of unbound methods as that would have break all the examples.

The original intention was to make this an error too,
but that would break example generation badly.
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work! What does this it look like when you run it and there's a route mismatch?

@andrascz
Copy link
Contributor Author

Excellent work! What does this it look like when you run it and there's a route mismatch?

In case of grpc method without HTTP rule:

W0317 16:42:06.689825  444590 services.go:38] No HttpRule found for method: CastleblackService.GetHealth

In case of HTTP Rule without matching grpc method:

--grpc-gateway_out: HTTP rules without a matching selector: .pb.CastleblackService.GetHealthz
make: *** [makefiles/protobuf.mk:18: pkg/pb] Error 1

@andrascz
Copy link
Contributor Author

We submitted the CLA, but not yet processed I guess, I will check daily and update when there is progress.

@johanbrandhorst
Copy link
Collaborator

We submitted the CLA, but not yet processed I guess, I will check daily and update when there is progress.

You trigger a check manually:

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.

@andrascz
Copy link
Contributor Author

You trigger a check manually:

Thanks, I know that, but the CLA page does not show me as signed yet and according to the doc:

If the contributor is covered by a corporate CLA, make sure that the corporation is listed at http://linkremoved/. If it’s not, it simply may not have been processed yet, which typically takes a few days.

@johanbrandhorst
Copy link
Collaborator

My bad!

@andrascz
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@johanbrandhorst johanbrandhorst merged commit ee51345 into grpc-ecosystem:master Mar 17, 2020
@johanbrandhorst
Copy link
Collaborator

Thanks for your contribution! A pleasure working with you 😁

@andrascz andrascz deleted the error-on-unbound-rules-or-methods branch May 8, 2020 14:29
tbg added a commit to cockroachdb/grpc-gateway that referenced this pull request May 19, 2020
This reverts commit ee51345.

Original PR: grpc-ecosystem#1178

In my opinion, logging this warning is unnecessary. It also breaks
CockroachDB's build; it has broken [Uber's build] before.

It is not a good assumption that every gRPC service defined needs
to have a HttpRule, and the workarounds are expensive.

[Uber's build]: uber/prototool#128
@yousseftelda
Copy link
Contributor

@johanbrandhorst What is rationale behind the warning on unbound methods? This produces a lot of warnings as we only want to generate a gateway for a subset of our gRPC services.
Can we put this behind a flag? Happy to open a PR.

@johanbrandhorst
Copy link
Collaborator

I'd be happy to remove the unbound method warning, it's much less likely to be unintentional than the HTTP route mismatch. Does that sound okay @andrascz?

@andrascz
Copy link
Contributor Author

Sure, it seems reasonable to make this configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

protoc-gen-grpc-gateway should warn or fail if a selector does not exist
4 participants