Skip to content

Commit ea3232c

Browse files
committed
Merge pull request #2284 from xhh/java-file-date-model-name-fix
[Java] Fix invalid imports when model name prefix/suffix is present
2 parents 9aa59b9 + 74fedfc commit ea3232c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ public JavaClientCodegen() {
8383
);
8484
instantiationTypes.put("array", "ArrayList");
8585
instantiationTypes.put("map", "HashMap");
86+
typeMapping.put("date", "Date");
87+
typeMapping.put("file", "File");
8688

8789
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
8890
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
@@ -488,7 +490,8 @@ public String getSwaggerType(Property p) {
488490
if (typeMapping.containsKey(swaggerType)) {
489491
type = typeMapping.get(swaggerType);
490492
if (languageSpecificPrimitives.contains(type) || type.indexOf(".") >= 0 ||
491-
type.equals("Map") || type.equals("List")) {
493+
type.equals("Map") || type.equals("List") ||
494+
type.equals("File") || type.equals("Date")) {
492495
return type;
493496
}
494497
} else {

0 commit comments

Comments
 (0)