-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
chore: Deprecate ambiguous API method names and provide non-ambiguous method names #3071
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3071 +/- ##
==========================================
+ Coverage 38.41% 38.65% +0.24%
==========================================
Files 168 168
Lines 18208 18297 +89
Branches 272 237 -35
==========================================
+ Hits 6994 7073 +79
- Misses 10341 10350 +9
- Partials 873 874 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I think it will be helpful to get consistent names in swagger. I don't know a better way of doing it.
@jessesuen do you have any objections?
…re/deprecate-api-methods
Will merge this PR without any objection received in the next 5 days (I think 30 days grace period should be more than sufficient). Shall we add log warnings when deprecated methods are still being used? @jessesuen @alexmt? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I don't agree with this. I feel we are unnecessarily moving to a flat namespacing, and eventually introducing API backwards incompatibility, for the sole purpose of making codegen slightly easier, which I think can be solved in a much easier way (e.g. rm -f swagger.json as part of make codegen).
Doing this will force us in the future to not allow method names to conflict in different gRPC services, even if the method name makes sense.
I don't know if removing the swagger.json file before regenerating it would help solving the issue (update: I just checked, it already is removed during codegen), which is not about codegen failing or being complicated. The problem I have observed is, once you touch the API i.e. by adding a new method or modifying its parameters, swagger happily reorders/renames its "mixin" functions. This is causing unneccessary merge conflicts in existing PRs which also had API modifications and would otherwise be completely compatible and could be merged without the renaming of mixins by swagger. It can become overly frustrating to maintain such a PR in a mergeable state over time. Also, it's quite hard to keep track of actual changes in the swagger file, because the commit history is sprayed with otherwise unnecessary changes. Also, we don't have to actually remove the old methods from the API, so we can keep backwards compatibility. Having them marked as deprecated will keep swagger from mixing them into spec, but they'll still be usable from a gRPC and REST client point of view.
As for flat namespacing, yes, your point is valid. I'm not very happy with it either and would love a solution where we can keep non-unique method names and not have swagger mixing constantly messing up the resulting definition file. |
FYI, the following PR would probably solve our problems: grpc-ecosystem/grpc-gateway#1193 It'll be included with upcoming v1.14.4 version of grpc-gateway, I'm preparing a PR to update our code generators once v1.14.4 has been released (a first RC has been released already). Closing this PR. |
https://github.com/grpc-ecosystem/grpc-gateway/releases/tag/v1.14.4 has been released. |
This PR aims for getting rid of constant
swagger.json
modifications oncodegen
due to ambiguous API method names. Change is non-functional and fully backwards compatible. Deprecated API methods can then be removed in any future version, i.e. v2.Checklist: