Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
cachescrubber committed Apr 7, 2022
1 parent 3fd8712 commit 3bb412a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
for (ModelsMap modelsAttrs : objs.values()) {
for (ModelMap mo : modelsAttrs.getModels()) {
CodegenModel codegenModel = mo.getModel();
Set<String> additionalImports = new HashSet<>();
Set<String> inheritedImports = new HashSet<>();
Map<String, CodegenProperty> propertyHash = new HashMap<>(codegenModel.vars.size());
for (final CodegenProperty property : codegenModel.vars) {
propertyHash.put(property.name, property);
Expand All @@ -923,7 +923,7 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
for (String imp: imports) {
// Avoid dupes
if (!codegenModel.getImports().contains(imp)) {
additionalImports.add(imp);
inheritedImports.add(imp);
codegenModel.getImports().add(imp);
}
}
Expand All @@ -932,7 +932,7 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
parentCodegenModel = parentCodegenModel.getParentModel();
}
// There must be a better way ...
for (String imp: additionalImports) {
for (String imp: inheritedImports) {
String qimp = importMapping().get(imp);
if (qimp != null) {
Map<String,String> toAdd = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,7 @@ public void oneOf_allOf() throws IOException {
// previous bugs
assertFileNotContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/BarRef.java"), "atTypesuper.hashCode");
assertFileNotContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/BarRef.java"), "private String atBaseType");
// imports for inherited properties
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/PizzaSpeziale.java"), "import java.math.BigDecimal");
}

Expand Down

0 comments on commit 3bb412a

Please sign in to comment.