Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[N4JS] Fix issue with broken module names in case of same names #16937

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading