forked from loafle/openapi-generator-original
[Java] fix bugs when property name, datatype are the same (#12581)
* fix bugs when property name, datatype are the same * add null check * add Locale.ROOT
This commit is contained in:
@@ -1330,6 +1330,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
if (property.isReadOnly) {
|
||||
model.getVendorExtensions().put("x-has-readonly-properties", true);
|
||||
}
|
||||
|
||||
// if data type happens to be the same as the property name and both are upper case
|
||||
if (property.dataType != null && property.dataType.equals(property.name) && property.dataType.toUpperCase(Locale.ROOT).equals(property.name)) {
|
||||
property.name = property.name.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user