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
Capitalization in variable names not preserved in some cases #357
Comments
Hello, thanks for the test repo. public static void main(String[] args) throws Exception {
final ObjectMapper objectMapper = new ObjectMapper();
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
System.out.println(objectMapper.writeValueAsString(new TestClassLombok(10, 10, 10)));
} and the output was: {
"abPosition" : 10,
"alongerVariableName" : 10,
"xposition" : 10
} so it seems that typescript-generator handles these names correctly. This naming depends on Jackson cooperation with Lombok. |
@justaparth were you able to make it work as needed? |
@vojtechhabarta Sorry for the late response, and thanks for the clarification. Just as you said, I confirmed it was consistent with the JSON serialization, which makes sense as the behavior typescript generator would want. Just in case anyone else comes across this, it seems at least some other people have had this issue with Lombok-generated getters for variable names of this type, i.e. In any case, after reading your comment, I was able to resolve it by not using lombok getters and defining them myself, getting consistent variable names and json serialization. Thanks again for your help!
|
@justaparth thanks for your comment. |
Hello,
I found that if a private instance variable with a standard getter (generated by Lombok or by hand) starts with a single lowercase letter followed by a capital letter, the capitalization is not preserved correctly.
I've made a reproducible and runnable version of my code here: https://github.com/justaparth/typescriptgentest
produces:
where I would have expected:
I suspect it is related to the getter somehow, since if I don't use lombok and define the getter as
getxPosition
instead ofgetXPosition
, then the capitalization works: (https://github.com/justaparth/typescriptgentest/blob/master/src/main/java/com/parth/testing/Classes.java#L27).Any help would be appreciated, thanks!
The text was updated successfully, but these errors were encountered: