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

Fixes 1398: deprecate Regiter_XXX_HandlerServer #1399

Merged
merged 6 commits into from
May 26, 2020
Merged

Fixes 1398: deprecate Regiter_XXX_HandlerServer #1399

merged 6 commits into from
May 26, 2020

Conversation

joesonw
Copy link
Contributor

@joesonw joesonw commented May 26, 2020

Gives deprecated notice when try to use Regiter_XXX_HandlerServer. Encourage using Register_XXX_FromEndpoint for full feature set and simplicity.

@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.

@joesonw
Copy link
Contributor Author

joesonw commented May 26, 2020

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@codecov-commenter
Copy link

codecov-commenter commented May 26, 2020

Codecov Report

Merging #1399 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1399   +/-   ##
=======================================
  Coverage   54.14%   54.14%           
=======================================
  Files          42       42           
  Lines        4375     4375           
=======================================
  Hits         2369     2369           
  Misses       1750     1750           
  Partials      256      256           
Impacted Files Coverage Δ
...c-gen-grpc-gateway/internal/gengateway/template.go 80.58% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3217094...924348b. Read the comment docs.

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.

Thanks for opening the PR! Just a small note on the new additions.

@@ -564,6 +564,7 @@ func local_request_{{.Method.Service.GetName}}_{{.Method.GetName}}_{{.Index}}(ct
// Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}Server registers the http handlers for service {{$svc.GetName}} to "mux".
// UnaryRPC :call {{$svc.GetName}}Server directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Deprecated :consider using Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}FromEndpoint instead. This will not provide grpc.ServerTransportStream https://github.com/grpc-ecosystem/grpc-gateway/issues/1398. This implementation will be missing certain features to behave like a standard stanalone grpc.Server.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a little heavy handed, I don't think we need to use the word "deprecated", this feature was only added earlier this year, and it does serve some users needs.

Suggested change
// Deprecated :consider using Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}FromEndpoint instead. This will not provide grpc.ServerTransportStream https://github.com/grpc-ecosystem/grpc-gateway/issues/1398. This implementation will be missing certain features to behave like a standard stanalone grpc.Server.
// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working . Consider using Register{{$svc.GetName}}{{$.RegisterFuncSuffix}}FromEndpoint instead.

Copy link
Contributor Author

@joesonw joesonw May 26, 2020

Choose a reason for hiding this comment

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

I wonder if there is a better way of warning people. In Goland, for example, It is really hard to notice the warnings, until you hover your cursor over the method for over a second or so and scroll all the way down to the note section.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need anything more than this. It's part of the documentation of the function, it should be one of the first places the user looks when using it.

@johanbrandhorst johanbrandhorst merged commit d61f9b3 into grpc-ecosystem:master May 26, 2020
@johanbrandhorst
Copy link
Collaborator

Thanks for your contribution! Could you cherry pick this against the v2 branch please?

johanbrandhorst pushed a commit that referenced this pull request May 26, 2020
* fix documentation error introduced by #1399

* fix test introduced by error
johanbrandhorst pushed a commit that referenced this pull request May 26, 2020
* cherry-pick #1399

* remove extra

* add missing test result change
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.

4 participants