forked from loafle/openapi-generator-original
[cleanup] erefactor/AutoRefactor - Log parameters rather than log message (#9133)
AutoRefactor cleanup 'LogParametersRatherThanLogMessage' applied by erefactor: Replaces a string concatenation as parameter of a logger method by a string template followed by objects. For AutoRefactor see https://github.com/JnRouvignac/AutoRefactor For erefactor see https://github.com/cal101/erefactor
This commit is contained in:
parent
19f5718477
commit
3cbc5a8f93
@ -183,7 +183,7 @@ public class KotlinServerDeprecatedCodegen extends AbstractKotlinCodegen {
|
||||
if (StringUtils.isEmpty(library)) {
|
||||
this.setLibrary(DEFAULT_LIBRARY);
|
||||
additionalProperties.put(CodegenConstants.LIBRARY, DEFAULT_LIBRARY);
|
||||
LOGGER.info("`library` option is empty. Default to " + DEFAULT_LIBRARY);
|
||||
LOGGER.info("`library` option is empty. Default to {}", DEFAULT_LIBRARY);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(Constants.AUTOMATIC_HEAD_REQUESTS)) {
|
||||
|
@ -303,7 +303,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
|
||||
this.setBasePackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
additionalProperties.put(BASE_PACKAGE, basePackage);
|
||||
LOGGER.info("Set base package to invoker package (" + basePackage + ")");
|
||||
LOGGER.info("Set base package to invoker package ({})", basePackage);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(BASE_PACKAGE)) {
|
||||
|
@ -301,7 +301,7 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
|
||||
if (modelVendorExtensions.containsKey(VENDOR_EXTENSION_SCHEMA)) {
|
||||
// user already specified schema values
|
||||
LOGGER.info("Found vendor extension in '" + modelName + "' model, autogeneration skipped");
|
||||
LOGGER.info("Found vendor extension in '{}' model, autogeneration skipped", modelName);
|
||||
} else {
|
||||
modelVendorExtensions.put(VENDOR_EXTENSION_SCHEMA, ktormSchema);
|
||||
ktormSchema.put("tableDefinition", tableDefinition);
|
||||
@ -359,7 +359,7 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
|
||||
if (vendorExtensions.containsKey(VENDOR_EXTENSION_SCHEMA)) {
|
||||
// user already specified schema values
|
||||
LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped");
|
||||
LOGGER.info("Found vendor extension in '{}' property, autogeneration skipped", baseName);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -688,7 +688,8 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
try {
|
||||
columnDefinition.put("colDefault", toColumnTypeDefault(defaultValue, dataType, dataFormat));
|
||||
} catch (RuntimeException exception) {
|
||||
LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to data type which doesn't support default value");
|
||||
LOGGER.warn("Property '{}' of model '{}' mapped to data type which doesn't support default value",
|
||||
baseName, model.getName());
|
||||
columnDefinition.put("colDefault", null);
|
||||
}
|
||||
}
|
||||
@ -985,7 +986,7 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
public String toDatabaseName(String name) {
|
||||
String identifier = toIdentifier(name, databaseNamePrefix, databaseNameSuffix);
|
||||
if (identifier.length() > IDENTIFIER_MAX_LENGTH) {
|
||||
LOGGER.warn("Database name too long. Name '" + name + "' will be truncated");
|
||||
LOGGER.warn("Database name too long. Name '{}' will be truncated", name);
|
||||
identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH);
|
||||
}
|
||||
return identifier;
|
||||
@ -1004,7 +1005,7 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
identifier = underscore(identifier);
|
||||
}
|
||||
if (identifier.length() > IDENTIFIER_MAX_LENGTH) {
|
||||
LOGGER.warn("Table name too long. Name '" + name + "' will be truncated");
|
||||
LOGGER.warn("Table name too long. Name '{}' will be truncated", name);
|
||||
identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH);
|
||||
}
|
||||
return identifier;
|
||||
@ -1023,7 +1024,7 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
identifier = underscore(identifier);
|
||||
}
|
||||
if (identifier.length() > IDENTIFIER_MAX_LENGTH) {
|
||||
LOGGER.warn("Column name too long. Name '" + name + "' will be truncated");
|
||||
LOGGER.warn("Column name too long. Name '{}' will be truncated", name);
|
||||
identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH);
|
||||
}
|
||||
return identifier;
|
||||
@ -1042,13 +1043,13 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
String escapedName = escapeQuotedIdentifier(name);
|
||||
// Database, table, and column names cannot end with space characters.
|
||||
if (escapedName.matches(".*\\s$")) {
|
||||
LOGGER.warn("Database, table, and column names cannot end with space characters. Check '" + name + "' name");
|
||||
LOGGER.warn("Database, table, and column names cannot end with space characters. Check '{}' name", name);
|
||||
escapedName = escapedName.replaceAll("\\s+$", "");
|
||||
}
|
||||
|
||||
// Identifiers may begin with a digit but unless quoted may not consist solely of digits.
|
||||
if (escapedName.matches("^\\d+$")) {
|
||||
LOGGER.warn("Database, table, and column names cannot consist solely of digits. Check '" + name + "' name");
|
||||
LOGGER.warn("Database, table, and column names cannot consist solely of digits. Check '{}' name", name);
|
||||
escapedName = prefix + escapedName + suffix;
|
||||
}
|
||||
|
||||
@ -1074,7 +1075,8 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
Pattern regexp = Pattern.compile("[^0-9a-zA-z$_\\x0080-\\xFFFF]");
|
||||
Matcher matcher = regexp.matcher(identifier);
|
||||
if (matcher.find()) {
|
||||
LOGGER.warn("Identifier '" + identifier + "' contains unsafe characters out of [0-9,a-z,A-Z$_] and U+0080..U+FFFF range");
|
||||
LOGGER.warn("Identifier '{}' contains unsafe characters out of [0-9,a-z,A-Z$_] and U+0080..U+FFFF range",
|
||||
identifier);
|
||||
identifier = identifier.replaceAll("[^0-9a-zA-z$_\\x0080-\\xFFFF]", "");
|
||||
}
|
||||
return identifier;
|
||||
@ -1106,7 +1108,9 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
public void setDefaultDatabaseName(String databaseName) {
|
||||
String escapedName = toDatabaseName(databaseName);
|
||||
if (!escapedName.equals(databaseName)) {
|
||||
LOGGER.error("Invalid database name. '" + databaseName + "' cannot be used as identifier. Escaped value '" + escapedName + "' will be used instead.");
|
||||
LOGGER.error(
|
||||
"Invalid database name. '{}' cannot be used as identifier. Escaped value '{}' will be used instead.",
|
||||
databaseName, escapedName);
|
||||
}
|
||||
this.defaultDatabaseName = escapedName;
|
||||
}
|
||||
@ -1152,7 +1156,8 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
this.identifierNamingConvention = naming;
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn("\"" + naming + "\" is invalid \"identifierNamingConvention\" argument. Current \"" + this.identifierNamingConvention + "\" used instead.");
|
||||
LOGGER.warn("\"{}\" is invalid \"identifierNamingConvention\" argument. Current \"{}\" used instead.",
|
||||
naming, this.identifierNamingConvention);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,13 +281,14 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + ("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, "model_" + name);
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + ("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
"model_" + name);
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -409,7 +410,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(sanitizedOperationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore("call_" + operationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, underscore("call_" + operationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
if (modelVendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) {
|
||||
// user already specified schema values
|
||||
LOGGER.info("Found vendor extension in '" + modelName + "' model, autogeneration skipped");
|
||||
LOGGER.info("Found vendor extension in '{}' model, autogeneration skipped", modelName);
|
||||
} else {
|
||||
modelVendorExtensions.put(VENDOR_EXTENSION_MYSQL_SCHEMA, mysqlSchema);
|
||||
mysqlSchema.put("tableDefinition", tableDefinition);
|
||||
@ -345,7 +345,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) {
|
||||
// user already specified schema values
|
||||
LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped");
|
||||
LOGGER.info("Found vendor extension in '{}' property, autogeneration skipped", baseName);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -364,7 +364,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
List<Object> enumValues = (List<Object>) allowableValues.get("values");
|
||||
for (int i = 0; i < enumValues.size(); i++) {
|
||||
if (i > ENUM_MAX_ELEMENTS - 1) {
|
||||
LOGGER.warn("ENUM column can have maximum of " + ENUM_MAX_ELEMENTS.toString() + " distinct elements, following value will be skipped: " + (String) enumValues.get(i));
|
||||
LOGGER.warn(
|
||||
"ENUM column can have maximum of {} distinct elements, following value will be skipped: {}",
|
||||
ENUM_MAX_ELEMENTS.toString(), (String) enumValues.get(i));
|
||||
break;
|
||||
}
|
||||
String value = String.valueOf(enumValues.get(i));
|
||||
@ -395,7 +397,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
try {
|
||||
columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType")));
|
||||
} catch (RuntimeException exception) {
|
||||
LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value");
|
||||
LOGGER.warn(
|
||||
"Property '{}' of model '{}' mapped to MySQL data type which doesn't support default value",
|
||||
baseName, model.getName());
|
||||
columnDefinition.put("colDefault", null);
|
||||
}
|
||||
}
|
||||
@ -432,7 +436,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) {
|
||||
// user already specified schema values
|
||||
LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped");
|
||||
LOGGER.info("Found vendor extension in '{}' property, autogeneration skipped", baseName);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -451,7 +455,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
List<Object> enumValues = (List<Object>) allowableValues.get("values");
|
||||
for (int i = 0; i < enumValues.size(); i++) {
|
||||
if (i > ENUM_MAX_ELEMENTS - 1) {
|
||||
LOGGER.warn("ENUM column can have maximum of " + ENUM_MAX_ELEMENTS.toString() + " distinct elements, following value will be skipped: " + (String) enumValues.get(i));
|
||||
LOGGER.warn(
|
||||
"ENUM column can have maximum of {} distinct elements, following value will be skipped: {}",
|
||||
ENUM_MAX_ELEMENTS.toString(), (String) enumValues.get(i));
|
||||
break;
|
||||
}
|
||||
String value = String.valueOf(enumValues.get(i));
|
||||
@ -481,7 +487,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
try {
|
||||
columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType")));
|
||||
} catch (RuntimeException exception) {
|
||||
LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value");
|
||||
LOGGER.warn(
|
||||
"Property '{}' of model '{}' mapped to MySQL data type which doesn't support default value",
|
||||
baseName, model.getName());
|
||||
columnDefinition.put("colDefault", null);
|
||||
}
|
||||
}
|
||||
@ -510,7 +518,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) {
|
||||
// user already specified schema values
|
||||
LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped");
|
||||
LOGGER.info("Found vendor extension in '{}' property, autogeneration skipped", baseName);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -534,7 +542,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
try {
|
||||
columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType")));
|
||||
} catch (RuntimeException exception) {
|
||||
LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value");
|
||||
LOGGER.warn(
|
||||
"Property '{}' of model '{}' mapped to MySQL data type which doesn't support default value",
|
||||
baseName, model.getName());
|
||||
columnDefinition.put("colDefault", null);
|
||||
}
|
||||
}
|
||||
@ -568,7 +578,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) {
|
||||
// user already specified schema values
|
||||
LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped");
|
||||
LOGGER.info("Found vendor extension in '{}' property, autogeneration skipped", baseName);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -589,7 +599,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
columnDefinition.put("colDataTypeArguments", columnDataTypeArguments);
|
||||
for (int i = 0; i < enumValues.size(); i++) {
|
||||
if (i > ENUM_MAX_ELEMENTS - 1) {
|
||||
LOGGER.warn("ENUM column can have maximum of " + ENUM_MAX_ELEMENTS.toString() + " distinct elements, following value will be skipped: " + (String) enumValues.get(i));
|
||||
LOGGER.warn(
|
||||
"ENUM column can have maximum of {} distinct elements, following value will be skipped: {}",
|
||||
ENUM_MAX_ELEMENTS.toString(), (String) enumValues.get(i));
|
||||
break;
|
||||
}
|
||||
String value = String.valueOf(enumValues.get(i));
|
||||
@ -613,7 +625,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
try {
|
||||
columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType")));
|
||||
} catch (RuntimeException exception) {
|
||||
LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value");
|
||||
LOGGER.warn(
|
||||
"Property '{}' of model '{}' mapped to MySQL data type which doesn't support default value",
|
||||
baseName, model.getName());
|
||||
columnDefinition.put("colDefault", null);
|
||||
}
|
||||
}
|
||||
@ -642,7 +656,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) {
|
||||
// user already specified schema values
|
||||
LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped");
|
||||
LOGGER.info("Found vendor extension in '{}' property, autogeneration skipped", baseName);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -664,7 +678,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
try {
|
||||
columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType")));
|
||||
} catch (RuntimeException exception) {
|
||||
LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value");
|
||||
LOGGER.warn(
|
||||
"Property '{}' of model '{}' mapped to MySQL data type which doesn't support default value",
|
||||
baseName, model.getName());
|
||||
columnDefinition.put("colDefault", null);
|
||||
}
|
||||
}
|
||||
@ -693,7 +709,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) {
|
||||
// user already specified schema values
|
||||
LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped");
|
||||
LOGGER.info("Found vendor extension in '{}' property, autogeneration skipped", baseName);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -718,7 +734,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
try {
|
||||
columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType")));
|
||||
} catch (RuntimeException exception) {
|
||||
LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value");
|
||||
LOGGER.warn(
|
||||
"Property '{}' of model '{}' mapped to MySQL data type which doesn't support default value",
|
||||
baseName, model.getName());
|
||||
columnDefinition.put("colDefault", null);
|
||||
}
|
||||
}
|
||||
@ -747,7 +765,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) {
|
||||
// user already specified schema values
|
||||
LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped");
|
||||
LOGGER.info("Found vendor extension in '{}' property, autogeneration skipped", baseName);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -769,7 +787,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
try {
|
||||
columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType")));
|
||||
} catch (RuntimeException exception) {
|
||||
LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value");
|
||||
LOGGER.warn(
|
||||
"Property '{}' of model '{}' mapped to MySQL data type which doesn't support default value",
|
||||
baseName, model.getName());
|
||||
columnDefinition.put("colDefault", null);
|
||||
}
|
||||
}
|
||||
@ -803,7 +823,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
arg.put("isInteger", false);
|
||||
arg.put("isNumeric", true);
|
||||
} else {
|
||||
LOGGER.warn("MySQL data type argument can be primitive type only. Class '" + value.getClass() + "' is provided");
|
||||
LOGGER.warn("MySQL data type argument can be primitive type only. Class '{}' is provided", value.getClass());
|
||||
}
|
||||
arg.put("argumentValue", value);
|
||||
return arg;
|
||||
@ -987,7 +1007,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
public String toDatabaseName(String name) {
|
||||
String identifier = toMysqlIdentifier(name, databaseNamePrefix, databaseNameSuffix);
|
||||
if (identifier.length() > IDENTIFIER_MAX_LENGTH) {
|
||||
LOGGER.warn("Database name cannot exceed 64 chars. Name '" + name + "' will be truncated");
|
||||
LOGGER.warn("Database name cannot exceed 64 chars. Name '{}' will be truncated", name);
|
||||
identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH);
|
||||
}
|
||||
return identifier;
|
||||
@ -1006,7 +1026,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
identifier = underscore(identifier);
|
||||
}
|
||||
if (identifier.length() > IDENTIFIER_MAX_LENGTH) {
|
||||
LOGGER.warn("Table name cannot exceed 64 chars. Name '" + name + "' will be truncated");
|
||||
LOGGER.warn("Table name cannot exceed 64 chars. Name '{}' will be truncated", name);
|
||||
identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH);
|
||||
}
|
||||
return identifier;
|
||||
@ -1025,7 +1045,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
identifier = underscore(identifier);
|
||||
}
|
||||
if (identifier.length() > IDENTIFIER_MAX_LENGTH) {
|
||||
LOGGER.warn("Column name cannot exceed 64 chars. Name '" + name + "' will be truncated");
|
||||
LOGGER.warn("Column name cannot exceed 64 chars. Name '{}' will be truncated", name);
|
||||
identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH);
|
||||
}
|
||||
return identifier;
|
||||
@ -1044,13 +1064,13 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
String escapedName = escapeMysqlQuotedIdentifier(name);
|
||||
// Database, table, and column names cannot end with space characters.
|
||||
if (escapedName.matches(".*\\s$")) {
|
||||
LOGGER.warn("Database, table, and column names cannot end with space characters. Check '" + name + "' name");
|
||||
LOGGER.warn("Database, table, and column names cannot end with space characters. Check '{}' name", name);
|
||||
escapedName = escapedName.replaceAll("\\s+$", "");
|
||||
}
|
||||
|
||||
// Identifiers may begin with a digit but unless quoted may not consist solely of digits.
|
||||
if (escapedName.matches("^\\d+$")) {
|
||||
LOGGER.warn("Database, table, and column names cannot consist solely of digits. Check '" + name + "' name");
|
||||
LOGGER.warn("Database, table, and column names cannot consist solely of digits. Check '{}' name", name);
|
||||
escapedName = prefix + escapedName + suffix;
|
||||
}
|
||||
|
||||
@ -1073,7 +1093,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
Pattern regexp = Pattern.compile("[^0-9a-zA-z$_\\u0080-\\uFFFF]");
|
||||
Matcher matcher = regexp.matcher(identifier);
|
||||
if (matcher.find()) {
|
||||
LOGGER.warn("Identifier '" + identifier + "' contains unsafe characters out of [0-9,a-z,A-Z$_] and U+0080..U+FFFF range");
|
||||
LOGGER.warn("Identifier '{}' contains unsafe characters out of [0-9,a-z,A-Z$_] and U+0080..U+FFFF range",
|
||||
identifier);
|
||||
identifier = identifier.replaceAll("[^0-9a-zA-z$_\\u0080-\\uFFFF]", "");
|
||||
}
|
||||
|
||||
@ -1095,7 +1116,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
Pattern regexp = Pattern.compile("[^\\u0001-\\u007F\\u0080-\\uFFFF]");
|
||||
Matcher matcher = regexp.matcher(identifier);
|
||||
if (matcher.find()) {
|
||||
LOGGER.warn("Identifier '" + identifier + "' contains unsafe characters out of U+0001..U+007F and U+0080..U+FFFF range");
|
||||
LOGGER.warn("Identifier '{}' contains unsafe characters out of U+0001..U+007F and U+0080..U+FFFF range",
|
||||
identifier);
|
||||
identifier = identifier.replaceAll("[^\\u0001-\\u007F\\u0080-\\uFFFF]", "");
|
||||
}
|
||||
|
||||
@ -1107,7 +1129,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
LOGGER.warn("'" + name + "' is MySQL reserved word. Do not use that word or properly escape it with backticks in mustache template");
|
||||
LOGGER.warn(
|
||||
"'{}' is MySQL reserved word. Do not use that word or properly escape it with backticks in mustache template",
|
||||
name);
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -1131,7 +1155,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
public void setDefaultDatabaseName(String databaseName) {
|
||||
String escapedName = toDatabaseName(databaseName);
|
||||
if (!escapedName.equals(databaseName)) {
|
||||
LOGGER.error("Invalid database name. '" + databaseName + "' cannot be used as MySQL identifier. Escaped value '" + escapedName + "' will be used instead.");
|
||||
LOGGER.error(
|
||||
"Invalid database name. '{}' cannot be used as MySQL identifier. Escaped value '{}' will be used instead.",
|
||||
databaseName, escapedName);
|
||||
}
|
||||
this.defaultDatabaseName = escapedName;
|
||||
}
|
||||
@ -1196,7 +1222,8 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
this.identifierNamingConvention = naming;
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn("\"" + naming + "\" is invalid \"identifierNamingConvention\" argument. Current \"" + this.identifierNamingConvention + "\" used instead.");
|
||||
LOGGER.warn("\"{}\" is invalid \"identifierNamingConvention\" argument. Current \"{}\" used instead.",
|
||||
naming, this.identifierNamingConvention);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ public class NimClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
LOGGER.warn("A reserved word \"" + name + "\" is used. Consider renaming the field name");
|
||||
LOGGER.warn("A reserved word \"{}\" is used. Consider renaming the field name", name);
|
||||
if (this.reservedWordsMappings().containsKey(name)) {
|
||||
return this.reservedWordsMappings().get(name);
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ public class NodeJSExpressServerCodegen extends DefaultCodegen implements Codege
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
}
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
// Restore interrupted state
|
||||
|
@ -530,13 +530,14 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + ("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, "model_" + name);
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number or _
|
||||
if (name.matches("^\\d.*|^_.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + ("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
"model_" + name);
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -578,14 +579,15 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
Schema inner = ap.getItems();
|
||||
if (inner == null) {
|
||||
LOGGER.warn(ap.getName() + "(array property) does not have a proper inner type defined.Default to string");
|
||||
LOGGER.warn("{}(array property) does not have a proper inner type defined.Default to string",
|
||||
ap.getName());
|
||||
inner = new StringSchema().description("TODO default missing array inner type to string");
|
||||
}
|
||||
return getTypeDeclaration(inner) + " list";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = getAdditionalProperties(p);
|
||||
if (inner == null) {
|
||||
LOGGER.warn(p.getName() + "(map property) does not have a proper inner type defined. Default to string");
|
||||
LOGGER.warn("{}(map property) does not have a proper inner type defined. Default to string", p.getName());
|
||||
inner = new StringSchema().description("TODO default missing map inner type to string");
|
||||
}
|
||||
String prefix = inner.getEnum() != null ? "Enums." : "";
|
||||
@ -637,7 +639,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(sanitizedOperationId) || sanitizedOperationId.matches("^[0-9].*")) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore("call_" + operationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, underscore("call_" + operationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
@ -814,7 +816,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
|
@ -435,7 +435,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public String toModelName(String type) {
|
||||
// model name cannot use reserved keyword
|
||||
if (reservedWords.contains(type)) {
|
||||
LOGGER.warn(type + " (reserved word) cannot be used as model name. Renamed to " + ("model_" + type) + " before further processing");
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {} before further processing",
|
||||
type, "model_" + type);
|
||||
type = "model_" + type; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
@ -614,7 +615,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), true));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
@ -765,7 +766,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
// e.g. [[SWGPet alloc] init
|
||||
example = "[[" + type + " alloc] init]";
|
||||
} else {
|
||||
LOGGER.warn("Example value for " + type + " not handled properly in setParameterExampleValue");
|
||||
LOGGER.warn("Example value for {} not handled properly in setParameterExampleValue", type);
|
||||
}
|
||||
|
||||
if (example == null) {
|
||||
|
@ -89,7 +89,7 @@ public class OpenAPIGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
try {
|
||||
String outputFile = outputFolder + File.separator + outputFileName;
|
||||
FileUtils.writeStringToFile(new File(outputFile), jsonOpenAPI, StandardCharsets.UTF_8);
|
||||
LOGGER.info("wrote file to " + outputFile);
|
||||
LOGGER.info("wrote file to {}", outputFile);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
|
@ -336,13 +336,14 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// model name cannot use reserved keyword
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, camelize("model_" + name));
|
||||
name = "model_" + name;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -409,19 +410,19 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
//rename to empty_function_name_1 (e.g.) if method name is empty
|
||||
if (StringUtils.isEmpty(operationId)) {
|
||||
operationId = underscore("empty_function_name_" + emptyFunctionNameCounter++);
|
||||
LOGGER.warn("Empty method name (operationId) found. Renamed to " + operationId);
|
||||
LOGGER.warn("Empty method name (operationId) found. Renamed to {}", operationId);
|
||||
return operationId;
|
||||
}
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId)));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, underscore(sanitizeName("call_" + operationId)));
|
||||
return underscore(sanitizeName("call_" + operationId));
|
||||
}
|
||||
|
||||
// operationId starts with a number
|
||||
if (operationId.matches("^\\d.*")) {
|
||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId)));
|
||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, underscore(sanitizeName("call_" + operationId)));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
@ -620,7 +621,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
|
@ -195,7 +195,9 @@ public class PhpSlim4ServerCodegen extends AbstractPhpCodegen {
|
||||
additionalProperties.put("isZendDiactoros", Boolean.TRUE);
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn("\"" + getPsr7Implementation() + "\" is invalid \"psr7Implementation\" codegen option. Default \"slim-psr7\" used instead.");
|
||||
LOGGER.warn(
|
||||
"\"{}\" is invalid \"psr7Implementation\" codegen option. Default \"slim-psr7\" used instead.",
|
||||
getPsr7Implementation());
|
||||
additionalProperties.put("isSlimPsr7", Boolean.TRUE);
|
||||
}
|
||||
|
||||
@ -353,7 +355,8 @@ public class PhpSlim4ServerCodegen extends AbstractPhpCodegen {
|
||||
break;
|
||||
default:
|
||||
this.psr7Implementation = "slim-psr7";
|
||||
LOGGER.warn("\"" + psr7Implementation + "\" is invalid \"psr7Implementation\" argument. Default \"slim-psr7\" used instead.");
|
||||
LOGGER.warn("\"{}\" is invalid \"psr7Implementation\" argument. Default \"slim-psr7\" used instead.",
|
||||
psr7Implementation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -742,11 +742,15 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) {
|
||||
LOGGER.warn(CodegenConstants.MODEL_PACKAGE + " with " + this.getName() + " generator is ignored. Setting this value independently of " + CodegenConstants.PACKAGE_NAME + " is not currently supported.");
|
||||
LOGGER.warn(
|
||||
"{} with {} generator is ignored. Setting this value independently of {} is not currently supported.",
|
||||
CodegenConstants.MODEL_PACKAGE, this.getName(), CodegenConstants.PACKAGE_NAME);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) {
|
||||
LOGGER.warn(CodegenConstants.API_PACKAGE + " with " + this.getName() + " generator is ignored. Setting this value independently of " + CodegenConstants.PACKAGE_NAME + " is not currently supported.");
|
||||
LOGGER.warn(
|
||||
"{} with {} generator is ignored. Setting this value independently of {} is not currently supported.",
|
||||
CodegenConstants.API_PACKAGE, this.getName(), CodegenConstants.PACKAGE_NAME);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT)) {
|
||||
@ -887,13 +891,15 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word or special variable name) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (reserved word or special variable name) cannot be used as model name. Renamed to {}",
|
||||
name, camelize("model_" + name));
|
||||
name = camelize("model_" + name); // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
camelize("model_" + name));
|
||||
name = camelize("model_" + name); // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -969,7 +975,8 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
|
||||
// for param name reserved word or word starting with number, append _
|
||||
if (paramNameReservedWords.contains(name) || name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (reserved word or special variable name) cannot be used in naming. Renamed to " + escapeReservedWord(name));
|
||||
LOGGER.warn("{} (reserved word or special variable name) cannot be used in naming. Renamed to {}", name,
|
||||
escapeReservedWord(name));
|
||||
name = escapeReservedWord(name);
|
||||
}
|
||||
|
||||
@ -1100,7 +1107,8 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
|
||||
// for reserved word or word starting with number, append _
|
||||
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (reserved word or special variable name) cannot be used in naming. Renamed to " + escapeReservedWord(name));
|
||||
LOGGER.warn("{} (reserved word or special variable name) cannot be used in naming. Renamed to {}", name,
|
||||
escapeReservedWord(name));
|
||||
name = escapeReservedWord(name);
|
||||
}
|
||||
|
||||
@ -1310,7 +1318,7 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
|
@ -176,7 +176,7 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId)));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId)));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
@ -390,13 +390,14 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,9 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
|
||||
|
||||
// default this to true so the python ModelSimple models will be generated
|
||||
ModelUtils.setGenerateAliasAsModel(true);
|
||||
LOGGER.info(CodegenConstants.GENERATE_ALIAS_AS_MODEL + " is hard coded to true in this generator. Alias models will only be generated if they contain validations or enums");
|
||||
LOGGER.info(
|
||||
"{} is hard coded to true in this generator. Alias models will only be generated if they contain validations or enums",
|
||||
CodegenConstants.GENERATE_ALIAS_AS_MODEL);
|
||||
|
||||
Boolean attrNoneIfUnset = false;
|
||||
if (additionalProperties.containsKey(CodegenConstants.PYTHON_ATTR_NONE_IF_UNSET)) {
|
||||
@ -1106,7 +1108,7 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
|
||||
String ref = ModelUtils.getSimpleRef(schema.get$ref());
|
||||
Schema refSchema = allDefinitions.get(ref);
|
||||
if (null == refSchema) {
|
||||
LOGGER.warn("Unable to find referenced schema " + schema.get$ref() + "\n");
|
||||
LOGGER.warn("Unable to find referenced schema {}\n", schema.get$ref());
|
||||
return fullPrefix + "None" + closeChars;
|
||||
}
|
||||
String refModelName = getModelName(schema);
|
||||
@ -1307,7 +1309,7 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
|
||||
}
|
||||
return fullPrefix + closeChars;
|
||||
} else {
|
||||
LOGGER.warn("Type " + schema.getType() + " not handled properly in toExampleValue");
|
||||
LOGGER.warn("Type {} not handled properly in toExampleValue", schema.getType());
|
||||
}
|
||||
|
||||
return example;
|
||||
|
@ -306,13 +306,14 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -402,7 +403,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(sanitizedOperationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore("call_" + operationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, underscore("call_" + operationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
@ -716,7 +717,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
if (modelMaps.containsKey(codegenParameter.dataType)) {
|
||||
return constructExampleCode(modelMaps.get(codegenParameter.dataType), modelMaps);
|
||||
} else {
|
||||
LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenParameter.dataType);
|
||||
LOGGER.error("Error in constructing examples. Failed to look up the model {}", codegenParameter.dataType);
|
||||
return "TODO";
|
||||
}
|
||||
}
|
||||
@ -750,7 +751,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
if (modelMaps.containsKey(codegenProperty.dataType)) {
|
||||
return constructExampleCode(modelMaps.get(codegenProperty.dataType), modelMaps);
|
||||
} else {
|
||||
LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenProperty.dataType);
|
||||
LOGGER.error("Error in constructing examples. Failed to look up the model {}", codegenProperty.dataType);
|
||||
return "TODO";
|
||||
}
|
||||
}
|
||||
|
@ -376,13 +376,14 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(modelName)) {
|
||||
modelName = camelize("Model" + modelName);
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (modelName.matches("^\\d.*")) {
|
||||
LOGGER.warn(modelName + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + modelName));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", modelName,
|
||||
camelize("model_" + modelName));
|
||||
modelName = "model_" + modelName; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -495,20 +496,20 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
|
||||
// rename to empty_method_name_1 (e.g.) if method name is empty
|
||||
if (StringUtils.isEmpty(operationId)) {
|
||||
operationId = underscore("empty_method_name_" + emptyMethodNameCounter++);
|
||||
LOGGER.warn("Empty method name (operationId) found. Renamed to " + operationId);
|
||||
LOGGER.warn("Empty method name (operationId) found. Renamed to {}", operationId);
|
||||
return operationId;
|
||||
}
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
String newOperationId = underscore("call_" + operationId);
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||
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 " + underscore(sanitizeName("call_" + operationId)));
|
||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, underscore(sanitizeName("call_" + operationId)));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class RubyOnRailsServerCodegen extends AbstractRubyCodegen {
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
String modelName = camelize("Model" + name);
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ public class RubyOnRailsServerCodegen extends AbstractRubyCodegen {
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
String filename = underscore("model_" + name);
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + filename);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model filename. Renamed to {}", name, filename);
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class RubySinatraServerCodegen extends AbstractRubyCodegen {
|
||||
public String toModelName(String name) {
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model filename. Renamed to {}", name, camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ public class RubySinatraServerCodegen extends AbstractRubyCodegen {
|
||||
public String toModelFilename(String name) {
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + underscore("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model filename. Renamed to {}", name, underscore("model_" + name));
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
|
@ -406,13 +406,14 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + ("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, "model_" + name);
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + ("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
"model_" + name);
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -454,14 +455,15 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
Schema inner = ap.getItems();
|
||||
if (inner == null) {
|
||||
LOGGER.warn(ap.getName() + "(array property) does not have a proper inner type defined.Default to string");
|
||||
LOGGER.warn("{}(array property) does not have a proper inner type defined.Default to string",
|
||||
ap.getName());
|
||||
inner = new StringSchema().description("TODO default missing array inner type to string");
|
||||
}
|
||||
return "Vec<" + getTypeDeclaration(inner) + ">";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = getAdditionalProperties(p);
|
||||
if (inner == null) {
|
||||
LOGGER.warn(p.getName() + "(map property) does not have a proper inner type defined. Default to string");
|
||||
LOGGER.warn("{}(map property) does not have a proper inner type defined. Default to string", p.getName());
|
||||
inner = new StringSchema().description("TODO default missing map inner type to string");
|
||||
}
|
||||
return "::std::collections::HashMap<String, " + getTypeDeclaration(inner) + ">";
|
||||
@ -502,7 +504,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(sanitizedOperationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + StringUtils.underscore("call_" + operationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, StringUtils.underscore("call_" + operationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user