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

naming convention not properly handled when generating java code #8

Closed
paolocanaletti opened this issue Oct 25, 2023 · 3 comments
Closed

Comments

@paolocanaletti
Copy link

Where the .proto file contains numbers and/or _ in the variable name the java code generated is not compiling.
Tested with latest version.

e.g.
providing a .proto file like the following

syntax = "proto3";
...
message Test {
     optional string id1issuertype= 1;
}

it will produce a java code where a method is defined as:
(note the uppercase I after 1)

boolean hasId1Issuertype();

but is then used as
(note the lowercase i after 1)

 ```

public java.util.Optional getOptionalId1issuertype() {
if (hasId1issuertype()) {
return java.util.Optional.of(getId1issuertype());
} else {
return java.util.Optional.empty();
}
}


it works properly if instead the char after the number is already uppercase in proto definition.
e.g.
optional string id1Issuertype= 1;
@Fadelis
Copy link
Owner

Fadelis commented Oct 26, 2023

I can replicate the issue when the variable is named id1issuertype, but you mention and/or _ in the variable name, can you give such example? Suggested naming pattern for protobuf variables is snake_case for which it works.
This uses standard protobuf library to get the definition and method names from proto files, so strange that they would parse it one way and then in java they would apply a different case.

@paolocanaletti
Copy link
Author

I am not able to replicate anymore the issue with _ , maybe I was confused by the test I did with different combination of numbers and _ , ignore the _

@Fadelis
Copy link
Owner

Fadelis commented Oct 27, 2023

Should be fixed in 1.10.0

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

No branches or pull requests

2 participants