-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Fix Ruby module name generation when the ruby_package option is used #5735
Fix Ruby module name generation when the ruby_package option is used #5735
Conversation
@@ -2,6 +2,6 @@ syntax = "proto3"; | |||
|
|||
package foo_bar; | |||
|
|||
option ruby_package = "A.B"; | |||
option ruby_package = "A::B"; |
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.
Does this change the existing API?
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.
Sort of, but I think the original implementation was incorrect.
In all other languages, the package options follow the same format as the language and ::
is the correct delimiter in Ruby.
For example, this proto has a bunch of language package options defined: https://github.com/googleapis/googleapis/blob/1a4f0f12777dc2f8bf2c2ce84438329639c75e29/google/pubsub/v1/pubsub.proto#L33
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.
Will this break existing users?
If so, can we support both for now?
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.
Maybe in protoc, we can throw warning if "A.B" is used.
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.
Supporting both options sounds like a good solution. I've updated it to work with both and issue a warning if the A.B
form is used instead of A::B
.
… option is used (protocolbuffers#5735)"" This reverts commit bb211e8.
…rotocolbuffers#5735) * fix module name generation and add tests * fix existing tests * support both package name styles
…is used (protocolbuffers#5735)" This reverts commit 9638dcc.
…(again) (protocolbuffers#5794) * Revert "Revert "Fix Ruby module name generation when the ruby_package option is used (protocolbuffers#5735)"" This reverts commit bb211e8. * add new files to Makefile.am
Resolves #5584 by ensure that the Ruby module name is always generated in the following format:
instead of:
I also added some tests for the
ruby_package
option.