-
Notifications
You must be signed in to change notification settings - Fork 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
properties with 2 chars upper case have getter and setter badly generated #445
Comments
fehguy
added a commit
that referenced
this issue
Mar 4, 2015
Defect (Issue #445) : change the call of initialCaps for getter and setter proper generation
cchafer
added a commit
to cchafer/swagger-codegen
that referenced
this issue
Mar 4, 2015
* commit '9ce4156e4cd1696b8758ed868fe3854ef19da2c9': Pull request swagger-api#452 : Add some unit tests for this PR Defect (Issue swagger-api#445) : change the call of initialCaps for getter and setter with Introspector.decapitalize from pakage java.beans.
@herveDarritchon - #447, #449 and #452 resolve together resolve this issue? |
yes. it's ok. it is resolved. |
Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a properties has the second character in uppercase, such as pId for example, the getter and setter are not well generated.
The getter and setter are generated like this getPId and setPId and it is not as it should be.
In fact, it should be getpId and setpId.
DefaultCodegen.java (line 441/442)
property.getter = "get" + initialCaps(name);
property.setter = "set" + initialCaps(name);
initialCaps is :
public String initialCaps(String name) {
return Character.toUpperCase(name.charAt(0)) + name.substring(1);
}
in the case of getter and setter, we should make an evolution to the code to be compliant with the getter and setter rules.
You should use Introspector.decapitalize from package java.beans instead of a home made function.
The text was updated successfully, but these errors were encountered: