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

Fix problem with underscores in rpc names #95

Merged
merged 1 commit into from
May 19, 2020
Merged

Fix problem with underscores in rpc names #95

merged 1 commit into from
May 19, 2020

Conversation

tagantroy
Copy link
Contributor

Fix for #94
Added underscore in method name support.
Also added example of proto file and test for new behavior.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 13, 2020

CLA Check
The committers are authorized under a signed CLA.

@@ -39,6 +39,16 @@ data class MemberSimpleName(val name: String) : CharSequence by name {
val OPERATOR_MINUS_ASSIGN = MemberSimpleName("minusAssign")
}

fun handleSpecialCharacters(): MemberSimpleName{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing a space before the { and, on the next line, after the if.

@@ -23,7 +23,7 @@ import com.google.protobuf.Descriptors.MethodDescriptor
/** Represents the unqualified name of an RPC method in a proto file, in UpperCamelCase. */
data class ProtoMethodName(val name: String) : CharSequence by name {
fun toMemberSimpleName(): MemberSimpleName =
MemberSimpleName(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, name))
MemberSimpleName(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, name)).handleSpecialCharacters()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This honestly looks like the processing ought to happen here, not in MemberSimpleName.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved code from MemberSimpleName and split into two methods

package io.grpc.testing.underscore;
option java_multiple_files = true;
service NameContainsUnderscore {
rpc say_hello (HelloRequest) returns (HelloReply);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test case for say_hello_again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added say_hello_again to proto and also unit test for this case to verify the behavior for names with multiple underscores

@lowasser lowasser merged commit c7f3ecc into grpc:master May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants