Skip to content

Commit

Permalink
Fix for self-referential imports in typescript-angular client (#6450)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bols authored and wing328 committed Oct 2, 2017
1 parent 1f4013e commit 44bf1d6
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,21 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) {
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;
}
Expand Down

0 comments on commit 44bf1d6

Please sign in to comment.