Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
willyko authored and wing328 committed Aug 12, 2017
1 parent 2ebb1bc commit 11424a8
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ public String toParamName(String name) {
public String toModelName(String name) {
// model name cannot use reserved keyword, e.g. return
if (isReservedWord(name)) {
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
String modelName = camelize("Model" + name);
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + modelName);
return modelName;
}

// camelize the model name
Expand All @@ -271,7 +273,9 @@ public String toModelName(String name) {
public String toModelFilename(String name) {
// model name cannot use reserved keyword, e.g. return
if (isReservedWord(name)) {
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
String filename = underscore("model_" + name);
LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + filename);
return filename;
}

// underscore the model file name
Expand Down Expand Up @@ -301,7 +305,9 @@ public String toApiName(String name) {
public String toOperationId(String operationId) {
// method name cannot use reserved keyword, e.g. return
if (isReservedWord(operationId)) {
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
String newOperationId = underscore("call_" + operationId);
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId);
return newOperationId;
}

return underscore(operationId);
Expand Down

0 comments on commit 11424a8

Please sign in to comment.