Update swift samples (#738)

* update all swift samples

* fix method name starting with number literal

* better handling of operationId starting with number

* update swift 4 samples
This commit is contained in:
Daiki Matsudate
2018-08-21 16:17:56 +09:00
committed by William Cheng
parent 2044c36398
commit fcfd8ea76e
384 changed files with 9628 additions and 14700 deletions

View File

@@ -454,6 +454,12 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
return newOperationId;
}
// operationId starts with a number
if (operationId.matches("^\\d.*")) {
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true));
operationId = camelize(sanitizeName("call_" + operationId), true);
}
return operationId;
}

View File

@@ -559,6 +559,13 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
return newOperationId;
}
// operationId starts with a number
if (operationId.matches("^\\d.*")) {
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true));
operationId = camelize(sanitizeName("call_" + operationId), true);
}
return operationId;
}

View File

@@ -450,6 +450,12 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
return newOperationId;
}
// operationId starts with a number
if (operationId.matches("^\\d.*")) {
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true));
operationId = camelize(sanitizeName("call_" + operationId), true);
}
return operationId;
}