You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using 2 java classes in our code: SystemDto, and SystemDTO (different casing in the class suffix, Dto vs DTO). The former is local from the current project while the latter is an external dependency.
I noticed that only one class is generated with one class overwriting the other.
Notice that a file JsonSystemDTO is generated with the class name as JsonSystemDto
In this scenario, I believe that swagger codegen is resolving the files in a case insensitive manner and overwriting each other.
Swagger-codegen version
Using swagger-codegen-maven-plugin version: 2.4.10
Since this is attached to our build, code was generated using mvn clean install
Suggest a fix/enhancement
I am not entirely sure since I have not debugged the project, but I noticed that io.swagger.codegen.DefaultCodegen has code which capitalizes model names, and api names. This can cause the following map below to have the same map key: io.swagger.codegen.DefaultGenerator.java line 385
/** * Output the API (class) name (capitalized) ending with "Api" * Return DefaultApi if name is empty * * @param name the name of the Api * @return capitalized Api name ending with "Api" */publicStringtoApiName(Stringname) {
if (name.length() == 0) {
return"DefaultApi";
}
returninitialCaps(name) + "Api";
}
/** * Output the proper model name (capitalized). * In case the name belongs to the TypeSystem it won't be renamed. * * @param name the name of the model * @return capitalized model name */publicStringtoModelName(finalStringname) {
returninitialCaps(modelNamePrefix + name + modelNameSuffix);
}
It may or may not be related.
The text was updated successfully, but these errors were encountered:
Hi team, I am facing a similar issue where the names are capitalized. Would be better if it was case insensitive. Please look into the issue, thank you.
The codegen generator actually tries to write the files, but one file is overwritn because the OS option. what suggestion you have for codegen in this scenario?
One option i have in mind is renaming one of the "repeated" definition. What do you guys think?
Description
We are using 2 java classes in our code: SystemDto, and SystemDTO (different casing in the class suffix, Dto vs DTO). The former is local from the current project while the latter is an external dependency.
I noticed that only one class is generated with one class overwriting the other.
Notice that a file
JsonSystemDTO
is generated with the class name asJsonSystemDto
In this scenario, I believe that swagger codegen is resolving the files in a case insensitive manner and overwriting each other.
Swagger-codegen version
Using swagger-codegen-maven-plugin version: 2.4.10
Maven Plugin config
Command line used for generation
Since this is attached to our build, code was generated using
mvn clean install
Suggest a fix/enhancement
I am not entirely sure since I have not debugged the project, but I noticed that
io.swagger.codegen.DefaultCodegen
has code which capitalizes model names, and api names. This can cause the following map below to have the same map key:io.swagger.codegen.DefaultGenerator.java
line 385io.swagger.codegen.DefaultCodegen
It may or may not be related.
The text was updated successfully, but these errors were encountered: