diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java index 3283bdb3239..cab99599846 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java @@ -270,19 +270,21 @@ public Map postProcessModels(Map objs) { for (Object _mo : models) { Map mo = (Map) _mo; CodegenModel cm = (CodegenModel) mo.get("model"); - mo.put("tsImports", toTsImports(cm.imports)); + mo.put("tsImports", toTsImports(cm,cm.imports)); } return result; } - private List> toTsImports(Set imports) { + private List> toTsImports(CodegenModel cm, Set imports) { List> tsImports = new ArrayList<>(); for(String im : imports) { + if(!im.equals(cm.classname)) { HashMap tsImport = new HashMap<>(); tsImport.put("classname", im); tsImport.put("filename", toModelFilename(im)); tsImports.add(tsImport); + } } return tsImports; }