-
Notifications
You must be signed in to change notification settings - Fork 327
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
Mention Protobuf Style Guides on the v7 protocol #269
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this implying that Twirp implementations may not fully support names that do not follow these conventions? That is to say, if you skip these conventions you're doing so "at your own risk" of compatibility problems. If this is the case, I think a little stronger warning may be needed here.
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.
We've been back and forth at length over this on #244
The issue is that, this is technically not a protocol problem, but the Go implementation does not respect the protocol, and looking closer it is not possible to entirely avoid naming collisions. This problem can be avoided by users if they respect the Protobuf Style Guide. And even if they don't it is usually not a problem because it is rare that someone uses potentially conflicting names like
MyMethod
andmyMethod
.We started including the recommendation for users on the docs: https://github.com/twitchtv/twirp/blob/master/docs/routing.md#naming-style.
The message here in the protocol spec is for developers working on a new Twirp implementation, in case they are wondering how to ensure full compatibility with the spec and other language implementations. Which is what happened to @ofpiyush, that started this conversation in detail.
Does it make more sense? Maybe I could use different words to make that a little more clear?
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.
If this is for developers working on a new Twirp implementation, I'd say give them the ability to treat names which do not follow the style guide in any way they desire (C-style Undefined Behavior). Something like "Twirp implementations MUST support names that follow the Protobuf Style Guide, and names which do not follow the Protobuf Style Guide MAY be modified by the implementation."
We should then update the Twirp user documentation to say that cross-language compatibility guarantees are only made if a user follows the Protobuf Style Guide for naming.
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.
The issue I (and other language implementations) ran into was with the wire protocol, not service and method names of generated code. Specifically, which URL should one serve and send requests to.
Service/ Method naming convention is only required for languages where case is meaningful. Go is the only language with this feature as far as I know.
In all other languages, one can just use the literal name for service names and methods in whatever format the protobuf file has, without any issues.
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.
I'll add a few more notes in the routing documentation. The protocol can be left without details about the Go implementation, the Service and Method parts of the routes should match the definitions in the proto files exactly, and the Go implementation will soon be able to do this thanks to #257 and #277