forked from loafle/openapi-generator-original
Fix for self-referential imports in typescript-angular client (#6450)
This commit is contained in:
@@ -270,19 +270,21 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
||||
for (Object _mo : models) {
|
||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||
mo.put("tsImports", toTsImports(cm.imports));
|
||||
mo.put("tsImports", toTsImports(cm,cm.imports));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<Map<String, String>> toTsImports(Set<String> imports) {
|
||||
private List<Map<String, String>> toTsImports(CodegenModel cm, Set<String> imports) {
|
||||
List<Map<String, String>> tsImports = new ArrayList<>();
|
||||
for(String im : imports) {
|
||||
if(!im.equals(cm.classname)) {
|
||||
HashMap<String, String> tsImport = new HashMap<>();
|
||||
tsImport.put("classname", im);
|
||||
tsImport.put("filename", toModelFilename(im));
|
||||
tsImports.add(tsImport);
|
||||
}
|
||||
}
|
||||
return tsImports;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user