Fixed issue that model name not camelized in python client and ruby client

This commit is contained in:
geekerzp
2015-09-24 15:53:55 +08:00
parent a49826e4d7
commit 84e0df6115
3 changed files with 5 additions and 1 deletions

View File

@@ -199,6 +199,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
@Override
public String toModelName(String name) {
name = name.replaceAll("\\W", "_");
// 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");

View File

@@ -224,6 +224,8 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override
public String toModelName(String name) {
name = name.replaceAll("\\W", "_");
// 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");