Merge pull request #1164 from ePaul/bugfix/1142-sanitize-api-name-for-spring-mvc

Issue #1142: sanitize api name before camelizing.
This commit is contained in:
wing328 2015-08-31 21:46:25 +08:00
commit b96fdb6766
2 changed files with 10 additions and 1 deletions

View File

@ -163,7 +163,7 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
if (name.length() == 0) {
return "DefaultApi";
}
name = name.replaceAll("[^a-zA-Z0-9]+", "_");
name = sanitizeName(name);
return camelize(name) + "Api";
}

View File

@ -175,6 +175,15 @@ public class SpringMVCServerCodegen extends JavaClientCodegen implements Codegen
return objs;
}
@Override
public String toApiName(String name) {
if (name.length() == 0) {
return "DefaultApi";
}
name = sanitizeName(name);
return camelize(name) + "Api";
}
public void setConfigPackage(String configPackage) {
this.configPackage = configPackage;
}