mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-18 16:39:21 +00:00
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:
committed by
William Cheng
parent
2044c36398
commit
fcfd8ea76e
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user