Issue #1142: sanitize the class name for Java model classes.

This builds on #1139, calling the new sanitizeName() method before camelizing it when generating model names.
This commit is contained in:
Paul Ebermann
2015-08-31 13:45:24 +02:00
parent 39ac64d24a
commit e0679c0b14

View File

@@ -237,6 +237,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override
public String toModelName(String name) {
name = sanitizeName(name);
// model name cannot use reserved keyword, e.g. return
if (reservedWords.contains(name)) {
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");