better reserved word handling for php

This commit is contained in:
wing328
2016-02-25 13:16:54 +08:00
parent 6bbd691913
commit 4e034d3dc5
7 changed files with 19 additions and 18 deletions

View File

@@ -395,7 +395,8 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
// method name cannot use reserved keyword, e.g. return
if (reservedWords.contains(operationId)) {
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true));
operationId = "call_" + operationId;
}
return camelize(sanitizeName(operationId), true);

View File

@@ -263,7 +263,7 @@
],
"parameters": [
{
"name": "package",
"name": "petId",
"in": "path",
"description": "ID of pet that needs to be fetched",
"required": true,