Skip to content

Commit

Permalink
n4js fix issue with broken module names due to same module names (#16937
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mmews-n4 committed Oct 30, 2023
1 parent 8827da8 commit 08d5183
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,10 @@ private boolean processBooleanOpt(String OPT, boolean defaultValue) {

@Override
public String toModelFilename(String name) {
String modelFilename = super.toModelFilename(name);
if (typeMapping.containsKey(modelFilename) || defaultIncludes.contains(modelFilename)) {
return modelFilename;
if (typeMapping.containsKey(name) || defaultIncludes.contains(name)) {
return name;
}
return modelFilename;
return super.toModelFilename(name);
}

public boolean checkRequiredBodyPropsNotNull() {
Expand Down Expand Up @@ -485,10 +484,11 @@ private Map<String, String> toN4jsImports(String className, Map<String, ModelsMa

@Override
public String toModelImport(String name) {
String modelImportName = toModelFilename(name);
if ("".equals(modelPackage())) {
return name;
return modelImportName;
} else {
return modelPackage() + "/" + name;
return modelPackage() + "/" + modelImportName;
}
}

Expand Down Expand Up @@ -564,7 +564,11 @@ protected String getParameterDataType(Parameter parameter, Schema p) {
return numericEnumValuesToEnumTypeUnion(new ArrayList<Number>(p.getEnum()));
}
}
return this.getTypeDeclaration(p);
String result = this.getTypeDeclaration(p);
if (result != null) {
result = toModelFilename(result);
}
return result;
}

@Override
Expand All @@ -578,7 +582,11 @@ protected String getSingleSchemaType(@SuppressWarnings("rawtypes") Schema schema
}
}
}
return super.getSingleSchemaType(unaliasSchema);
String result = super.getSingleSchemaType(unaliasSchema);
if (result != null) {
result = toModelFilename(result);
}
return result;
}

/**
Expand Down

0 comments on commit 08d5183

Please sign in to comment.