-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Description
Description
When using jaxrs-cxf-cdi and other JaxRS generators, the implFolder config is not honored by hte generator on windows.
The issue is due to file path manipulations in AbstractJavaJAXRSServerCodegen:apiFilename that uses '/' as a separator, while DefaultCodeGen:apiFilename uses File.separator since e7f4fb3 introduced for #7808
Swagger-codegen version
Tested on 2.3.1 and 2.4.0-SNAPSHOT, and this is a regression w.r.t. 2.2.2
Related issues/PRs
The issue that seemingly introduced the regression: #6443
Suggest a fix/enhancement
Use File.separator in AbstractJavaJAXRSServerCodegen:apiFilename
@Override
public String apiFilename(String templateName, String tag) {
String result = super.apiFilename(templateName, tag);
if ( templateName.endsWith("Impl.mustache") ) {
int ix = result.lastIndexOf(File.separator);
result = result.substring(0, ix) + "/impl" + result.substring(ix, result.length() - 5) + "ServiceImpl.java";
result = result.replace(apiFileFolder(), implFileFolder(implFolder));
} else if ( templateName.endsWith("Factory.mustache") ) {
int ix = result.lastIndexOf(File.separator);
result = result.substring(0, ix) + "/factories" + result.substring(ix, result.length() - 5) + "ServiceFactory.java";
result = result.replace(apiFileFolder(), implFileFolder(implFolder));
} else if ( templateName.endsWith("Service.mustache") ) {
int ix = result.lastIndexOf('.');
result = result.substring(0, ix) + "Service.java";
}
return result;
}
Metadata
Metadata
Assignees
Labels
No labels