forked from loafle/openapi-generator-original
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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user