forked from loafle/openapi-generator-original
[cleanup] erefactor/AutoRefactor - Log parameters rather than log message (#9664)
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:
@@ -153,7 +153,7 @@ public class Generator {
|
||||
List<File> files = new DefaultGenerator().opts(clientOptInput).generate();
|
||||
if (files.size() > 0) {
|
||||
List<File> filesToAdd = new ArrayList<>();
|
||||
LOGGER.debug("adding to " + outputFolder);
|
||||
LOGGER.debug("adding to {}", outputFolder);
|
||||
filesToAdd.add(new File(outputFolder));
|
||||
ZipUtil zip = new ZipUtil();
|
||||
zip.compressFiles(filesToAdd, outputFilename);
|
||||
|
||||
@@ -2711,14 +2711,18 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
String modelName = ModelUtils.getSimpleRef(oneOf.get$ref());
|
||||
CodegenProperty thisCp = discriminatorFound(composedSchemaName, oneOf, discPropName, openAPI);
|
||||
if (thisCp == null) {
|
||||
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced OneOf schema '" + modelName + "' is missing " + discPropName);
|
||||
LOGGER.warn(
|
||||
"'{}' defines discriminator '{}', but the referenced OneOf schema '{}' is missing {}",
|
||||
composedSchemaName, discPropName, modelName, discPropName);
|
||||
}
|
||||
if (cp.dataType == null) {
|
||||
cp = thisCp;
|
||||
continue;
|
||||
}
|
||||
if (cp != thisCp) {
|
||||
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the OneOf schema '" + modelName + "' has a different " + discPropName + " definition than the prior OneOf schema's. Make sure the " + discPropName + " type and required values are the same");
|
||||
LOGGER.warn(
|
||||
"'{}' defines discriminator '{}', but the OneOf schema '{}' has a different {} definition than the prior OneOf schema's. Make sure the {} type and required values are the same",
|
||||
composedSchemaName, discPropName, modelName, discPropName, discPropName);
|
||||
}
|
||||
}
|
||||
return cp;
|
||||
@@ -2730,14 +2734,18 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
String modelName = ModelUtils.getSimpleRef(anyOf.get$ref());
|
||||
CodegenProperty thisCp = discriminatorFound(composedSchemaName, anyOf, discPropName, openAPI);
|
||||
if (thisCp == null) {
|
||||
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced AnyOf schema '" + modelName + "' is missing " + discPropName);
|
||||
LOGGER.warn(
|
||||
"'{}' defines discriminator '{}', but the referenced AnyOf schema '{}' is missing {}",
|
||||
composedSchemaName, discPropName, modelName, discPropName);
|
||||
}
|
||||
if (cp.dataType == null) {
|
||||
cp = thisCp;
|
||||
continue;
|
||||
}
|
||||
if (cp != thisCp) {
|
||||
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the AnyOf schema '" + modelName + "' has a different " + discPropName + " definition than the prior AnyOf schema's. Make sure the " + discPropName + " type and required values are the same");
|
||||
LOGGER.warn(
|
||||
"'{}' defines discriminator '{}', but the AnyOf schema '{}' has a different {} definition than the prior AnyOf schema's. Make sure the {} type and required values are the same",
|
||||
composedSchemaName, discPropName, modelName, discPropName, discPropName);
|
||||
}
|
||||
}
|
||||
return cp;
|
||||
@@ -2875,7 +2883,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// schemas also has inline composed schemas
|
||||
// Note: if it is only inline one level, then the inline model resolver will move it into its own
|
||||
// schema and make it a $ref schema in the oneOf/anyOf location
|
||||
LOGGER.warn("Invalid inline schema defined in oneOf/anyOf in '" + composedSchemaName + "'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the oneOf/anyOf schemas must use $ref. Change this inline definition to a $ref definition");
|
||||
LOGGER.warn(
|
||||
"Invalid inline schema defined in oneOf/anyOf in '{}'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the oneOf/anyOf schemas must use $ref. Change this inline definition to a $ref definition",
|
||||
composedSchemaName);
|
||||
}
|
||||
CodegenProperty df = discriminatorFound(composedSchemaName, sc, discPropName, openAPI);
|
||||
String modelName = ModelUtils.getSimpleRef(ref);
|
||||
@@ -2895,7 +2905,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
msgSuffix += spacer + "invalid optional definition of " + discPropName + ", include it in required";
|
||||
}
|
||||
}
|
||||
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced schema '" + modelName + "' is incorrect. " + msgSuffix);
|
||||
LOGGER.warn("'{}' defines discriminator '{}', but the referenced schema '{}' is incorrect. {}",
|
||||
composedSchemaName, discPropName, modelName, msgSuffix);
|
||||
}
|
||||
MappedModel mm = new MappedModel(modelName, toModelName(modelName));
|
||||
descendentSchemas.add(mm);
|
||||
@@ -4436,7 +4447,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
else {
|
||||
LOGGER.warn("No object schema found for deepObject parameter" + codegenParameter + " deepObject won't have specific properties");
|
||||
LOGGER.warn(
|
||||
"No object schema found for deepObject parameter{} deepObject won't have specific properties",
|
||||
codegenParameter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4728,7 +4741,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
if (!co.operationId.equals(uniqueName)) {
|
||||
LOGGER.warn("generated unique operationId `" + uniqueName + "`");
|
||||
LOGGER.warn("generated unique operationId `{}`", uniqueName);
|
||||
}
|
||||
co.operationId = uniqueName;
|
||||
co.operationIdLowerCase = uniqueName.toLowerCase(Locale.ROOT);
|
||||
@@ -4883,7 +4896,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
final String key = entry.getKey();
|
||||
final Schema prop = entry.getValue();
|
||||
if (prop == null) {
|
||||
LOGGER.warn("Please report the issue. There shouldn't be null property for " + key);
|
||||
LOGGER.warn("Please report the issue. There shouldn't be null property for {}", key);
|
||||
} else {
|
||||
final CodegenProperty cp = fromProperty(key, prop);
|
||||
cp.required = mandatory.contains(key);
|
||||
|
||||
@@ -204,7 +204,7 @@ public class ExampleGenerator {
|
||||
output.add(kv);
|
||||
} else if (mediaType.startsWith(MIME_TYPE_XML)) {
|
||||
// TODO
|
||||
LOGGER.warn("XML example value of (array/primitive) is not handled at the moment: " + example);
|
||||
LOGGER.warn("XML example value of (array/primitive) is not handled at the moment: {}", example);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,7 +296,7 @@ public class ExampleGenerator {
|
||||
LOGGER.debug("URI or URL format, without default or enum, generating random one.");
|
||||
return "http://example.com/aeiou";
|
||||
}
|
||||
LOGGER.debug("No values found, using property name " + propertyName + " as example");
|
||||
LOGGER.debug("No values found, using property name {} as example", propertyName);
|
||||
return propertyName;
|
||||
} else if (!StringUtils.isEmpty(property.get$ref())) { // model
|
||||
String simpleName = ModelUtils.getSimpleRef(property.get$ref());
|
||||
|
||||
@@ -220,7 +220,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
protected String toAdaIdentifier(String name, String prefix) {
|
||||
// We cannot use reserved keywords for identifiers
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn("Identifier '" + name + "' is a reserved word, renamed to " + prefix + name);
|
||||
LOGGER.warn("Identifier '{}' is a reserved word, renamed to {}{}", name, prefix, name);
|
||||
name = prefix + name;
|
||||
}
|
||||
StringBuilder result = new StringBuilder();
|
||||
@@ -287,20 +287,22 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
String modelName = "Model_" + result;
|
||||
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 (result.matches("^\\d.*")) {
|
||||
String modelName = "Model_" + result; // e.g. 200Response => Model_200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
if (languageSpecificPrimitives.contains(result)) {
|
||||
String modelName = "Model_" + result;
|
||||
LOGGER.warn(name + " (model name matches existing language type) cannot be used as a model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name matches existing language type) cannot be used as a model name. Renamed to {}",
|
||||
name, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,14 +162,15 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(camelizedName)) {
|
||||
final String modelName = "Model" + camelizedName;
|
||||
LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (camelizedName.matches("^\\d.*")) {
|
||||
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@@ -188,7 +189,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
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");
|
||||
LOGGER.warn("{}(array property) does not have a proper inner type defined", ap.getName());
|
||||
// TODO maybe better defaulting to StringProperty than returning null
|
||||
return null;
|
||||
}
|
||||
@@ -197,7 +198,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
Schema inner = getAdditionalProperties(p);
|
||||
|
||||
if (inner == null) {
|
||||
LOGGER.warn(p.getName() + "(map property) does not have a proper inner type defined");
|
||||
LOGGER.warn("{}(map property) does not have a proper inner type defined", p.getName());
|
||||
// TODO maybe better defaulting to StringProperty than returning null
|
||||
return null;
|
||||
}
|
||||
@@ -408,7 +409,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
if (null == schemaType) {
|
||||
LOGGER.error("No Type defined for Property " + p);
|
||||
LOGGER.error("No Type defined for Property {}", p);
|
||||
}
|
||||
return toModelName(schemaType);
|
||||
}
|
||||
@@ -425,7 +426,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
String newOperationId = camelize("call_" + operationId, true);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -789,13 +789,13 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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)));
|
||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId)));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
@@ -1032,13 +1032,14 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
@@ -1267,7 +1268,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
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());
|
||||
|
||||
@@ -237,7 +237,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
if (isReservedWord(operationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + escapeReservedWord(operationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, escapeReservedWord(operationId));
|
||||
return escapeReservedWord(operationId);
|
||||
}
|
||||
return sanitizeName(super.toOperationId(operationId));
|
||||
@@ -329,7 +329,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
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());
|
||||
|
||||
@@ -192,22 +192,22 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// 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)
|
||||
}
|
||||
// model name starts with _
|
||||
if (name.startsWith("_")) {
|
||||
LOGGER.warn(name + " (model name starts with _) cannot be used as model name. Renamed to "
|
||||
+ ("model" + name));
|
||||
LOGGER.warn("{} (model name starts with _) cannot be used as model name. Renamed to {}", name,
|
||||
"model" + name);
|
||||
name = "model" + name; // e.g. 200Response => Model200Response
|
||||
// (after camelize)
|
||||
}
|
||||
@@ -344,8 +344,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// 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 "
|
||||
+ camelize("call_" + operationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize("call_" + operationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
@@ -609,7 +608,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
@Override
|
||||
protected void updatePropertyForArray(CodegenProperty property, CodegenProperty innerProperty) {
|
||||
if (innerProperty == null) {
|
||||
LOGGER.warn("skipping invalid array property " + Json.pretty(property));
|
||||
LOGGER.warn("skipping invalid array property {}", Json.pretty(property));
|
||||
return;
|
||||
}
|
||||
property.dataFormat = innerProperty.dataFormat;
|
||||
|
||||
@@ -628,13 +628,13 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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)));
|
||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId)));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
@@ -900,13 +900,14 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
@@ -1121,7 +1122,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
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());
|
||||
|
||||
@@ -202,7 +202,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
// for reserved word append _
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as variable name. Renamed to " + escapeReservedWord(name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as variable name. Renamed to {}", name, escapeReservedWord(name));
|
||||
name = escapeReservedWord(name);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
// really should just be a letter, e.g. "p Person"), but we'll get
|
||||
// around to that some other time... Maybe.
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as parameter name. Renamed to " + name + "_");
|
||||
LOGGER.warn("{} (reserved word) cannot be used as parameter name. Renamed to {}_", name, name);
|
||||
name = name + "_";
|
||||
}
|
||||
|
||||
@@ -269,7 +269,8 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
name = toModel("model_" + name);
|
||||
|
||||
if (isReservedFilename(name)) {
|
||||
LOGGER.warn(name + ".go with suffix (reserved word) cannot be used as filename. Renamed to " + name + "_.go");
|
||||
LOGGER.warn("{}.go with suffix (reserved word) cannot be used as filename. Renamed to {}_.go", name,
|
||||
name);
|
||||
name += "_";
|
||||
}
|
||||
return name;
|
||||
@@ -292,14 +293,14 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
@@ -317,7 +318,8 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
// e.g. PetApi.go => pet_api.go
|
||||
api = "api_" + underscore(api);
|
||||
if (isReservedFilename(api)) {
|
||||
LOGGER.warn(name + ".go with suffix (reserved word) cannot be used as filename. Renamed to " + api + "_.go");
|
||||
LOGGER.warn("{}.go with suffix (reserved word) cannot be used as filename. Renamed to {}_.go", name,
|
||||
api);
|
||||
api += "_";
|
||||
}
|
||||
apiName = api;
|
||||
@@ -441,14 +443,13 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
// 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 "
|
||||
+ camelize("call_" + sanitizedOperationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize("call_" + sanitizedOperationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
// operationId starts with a number
|
||||
if (sanitizedOperationId.matches("^\\d.*")) {
|
||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + sanitizedOperationId));
|
||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize("call_" + sanitizedOperationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
@@ -831,7 +832,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
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());
|
||||
|
||||
@@ -193,13 +193,14 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
@@ -317,7 +318,7 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -313,13 +313,14 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
String derivedInvokerPackage = deriveInvokerPackageName((String) additionalProperties.get(CodegenConstants.API_PACKAGE));
|
||||
this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, derivedInvokerPackage);
|
||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
LOGGER.info("Invoker Package Name, originally not set, is now derived from api package name: " + derivedInvokerPackage);
|
||||
LOGGER.info("Invoker Package Name, originally not set, is now derived from api package name: {}", derivedInvokerPackage);
|
||||
} else if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) {
|
||||
// guess from model package
|
||||
String derivedInvokerPackage = deriveInvokerPackageName((String) additionalProperties.get(CodegenConstants.MODEL_PACKAGE));
|
||||
this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, derivedInvokerPackage);
|
||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
LOGGER.info("Invoker Package Name, originally not set, is now derived from model package name: " + derivedInvokerPackage);
|
||||
LOGGER.info("Invoker Package Name, originally not set, is now derived from model package name: {}",
|
||||
derivedInvokerPackage);
|
||||
} else {
|
||||
//not set, use default to be passed to template
|
||||
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
|
||||
@@ -786,14 +787,15 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(camelizedName)) {
|
||||
final String modelName = "Model" + camelizedName;
|
||||
LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (camelizedName.matches("^\\d.*")) {
|
||||
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@@ -1140,7 +1142,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
if (null == openAPIType) {
|
||||
LOGGER.error("No Type defined for Schema " + p);
|
||||
LOGGER.error("No Type defined for Schema {}", p);
|
||||
}
|
||||
return toModelName(openAPIType);
|
||||
}
|
||||
@@ -1157,7 +1159,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
String newOperationId = camelize("call_" + operationId, true);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1284,7 +1286,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
continue;
|
||||
}
|
||||
for (Operation operation : path.readOperations()) {
|
||||
LOGGER.info("Processing operation " + operation.getOperationId());
|
||||
LOGGER.info("Processing operation {}", operation.getOperationId());
|
||||
if (hasBodyParameter(openAPI, operation) || hasFormParameter(openAPI, operation)) {
|
||||
String defaultContentType = hasFormParameter(openAPI, operation) ? "application/x-www-form-urlencoded" : "application/json";
|
||||
List<String> consumes = new ArrayList<>(getConsumesInfo(openAPI, operation));
|
||||
@@ -1838,7 +1840,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
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());
|
||||
|
||||
@@ -421,7 +421,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
|
||||
LOGGER.warn(CodegenConstants.INVOKER_PACKAGE + " with " + this.getName() + " generator is ignored. Use " + CodegenConstants.PACKAGE_NAME + ".");
|
||||
LOGGER.warn("{} with {} generator is ignored. Use {}.", CodegenConstants.INVOKER_PACKAGE, this.getName(), CodegenConstants.PACKAGE_NAME);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SERIALIZABLE_MODEL)) {
|
||||
@@ -624,14 +624,15 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(modifiedName)) {
|
||||
final String modelName = "Model" + modifiedName;
|
||||
LOGGER.warn(modifiedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", modifiedName, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (modifiedName.matches("^\\d.*")) {
|
||||
final String modelName = "Model" + modifiedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@@ -655,7 +656,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
String newOperationId = camelize("call_" + operationId, true);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -890,7 +891,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
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());
|
||||
|
||||
@@ -295,14 +295,15 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
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) + "[]";
|
||||
} 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 getSchemaType(p) + "<string," + getTypeDeclaration(inner) + ">";
|
||||
@@ -408,13 +409,14 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
// 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; // 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)
|
||||
}
|
||||
|
||||
@@ -492,13 +494,13 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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));
|
||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), true));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
@@ -590,7 +592,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
// type is a model class, e.g. User
|
||||
example = "new " + getTypeDeclaration(type) + "()";
|
||||
} else {
|
||||
LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue");
|
||||
LOGGER.warn("Type {} not handled properly in setParameterExampleValue", type);
|
||||
}
|
||||
|
||||
if (example == null) {
|
||||
@@ -747,7 +749,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
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());
|
||||
|
||||
@@ -343,7 +343,9 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
fixedPath += "/" + token;
|
||||
}
|
||||
if (!fixedPath.equals(pathname)) {
|
||||
LOGGER.warn("Path '" + pathname + "' is not consistant with Python variable names. It will be replaced by '" + fixedPath + "'");
|
||||
LOGGER.warn(
|
||||
"Path '{}' is not consistant with Python variable names. It will be replaced by '{}'",
|
||||
pathname, fixedPath);
|
||||
paths.remove(pathname);
|
||||
path.addExtension("x-python-connexion-openapi-name", pathname);
|
||||
paths.put(fixedPath, path);
|
||||
@@ -373,12 +375,14 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
String swaggerParameterName = parameter.getName();
|
||||
String pythonParameterName = this.toParamName(swaggerParameterName);
|
||||
if (!swaggerParameterName.equals(pythonParameterName)) {
|
||||
LOGGER.warn("Parameter name '" + swaggerParameterName + "' is not consistant with Python variable names. It will be replaced by '" + pythonParameterName + "'");
|
||||
LOGGER.warn(
|
||||
"Parameter name '{}' is not consistant with Python variable names. It will be replaced by '{}'",
|
||||
swaggerParameterName, pythonParameterName);
|
||||
parameter.addExtension("x-python-connexion-openapi-name", swaggerParameterName);
|
||||
parameter.setName(pythonParameterName);
|
||||
}
|
||||
if (swaggerParameterName.isEmpty()) {
|
||||
LOGGER.error("Missing parameter name in " + pathname + "." + parameter.getIn());
|
||||
LOGGER.error("Missing parameter name in {}.{}", pathname, parameter.getIn());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -435,13 +439,13 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
}
|
||||
break;
|
||||
case OPENIDCONNECT:
|
||||
LOGGER.warn("Security type " + securityScheme.getType().toString() + " is not supported by connextion yet");
|
||||
LOGGER.warn("Security type {} is not supported by connextion yet", securityScheme.getType().toString());
|
||||
case OAUTH2:
|
||||
addSecurityExtension(securityScheme, "x-tokenInfoFunc", baseFunctionName + "info_from_" + securityName);
|
||||
addSecurityExtension(securityScheme, "x-scopeValidateFunc", baseFunctionName + "validate_scope_" + securityName);
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn("Unknown security type " + securityScheme.getType().toString());
|
||||
LOGGER.warn("Unknown security type {}", securityScheme.getType().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -498,7 +502,9 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
// Get and remove the (temporary) vendor extension
|
||||
String openapiPathname = (String) pathExtensions.remove("x-python-connexion-openapi-name");
|
||||
if (openapiPathname != null && !openapiPathname.equals(pythonPathname)) {
|
||||
LOGGER.info("Path '" + pythonPathname + "' is not consistant with the original OpenAPI definition. It will be replaced back by '" + openapiPathname + "'");
|
||||
LOGGER.info(
|
||||
"Path '{}' is not consistant with the original OpenAPI definition. It will be replaced back by '{}'",
|
||||
pythonPathname, openapiPathname);
|
||||
paths.remove(pythonPathname);
|
||||
paths.put(openapiPathname, path);
|
||||
}
|
||||
@@ -517,13 +523,18 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
if (swaggerParameterName != null) {
|
||||
String pythonParameterName = parameter.getName();
|
||||
if (!swaggerParameterName.equals(pythonParameterName)) {
|
||||
LOGGER.info("Reverting name of parameter '" + pythonParameterName + "' of operation '" + operation.getOperationId() + "' back to '" + swaggerParameterName + "'");
|
||||
LOGGER.info(
|
||||
"Reverting name of parameter '{}' of operation '{}' back to '{}'",
|
||||
pythonParameterName, operation.getOperationId(), swaggerParameterName);
|
||||
parameter.setName(swaggerParameterName);
|
||||
} else {
|
||||
LOGGER.debug("Name of parameter '" + pythonParameterName + "' of operation '" + operation.getOperationId() + "' was unchanged.");
|
||||
LOGGER.debug("Name of parameter '{}' of operation '{}' was unchanged.",
|
||||
pythonParameterName, operation.getOperationId());
|
||||
}
|
||||
} else {
|
||||
LOGGER.debug("x-python-connexion-openapi-name was not set on parameter '" + parameter.getName() + "' of operation '" + operation.getOperationId() + "'");
|
||||
LOGGER.debug(
|
||||
"x-python-connexion-openapi-name was not set on parameter '{}' of operation '{}'",
|
||||
parameter.getName(), operation.getOperationId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,14 +461,15 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(camelizedName)) {
|
||||
final String modelName = "Model" + camelizedName;
|
||||
LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@@ -531,7 +532,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
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());
|
||||
@@ -553,7 +554,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
String newOperationId = camelize("call_" + operationId, true);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -390,20 +390,22 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
// this is unlikely to happen, because we have just camelized the name, while reserved words are usually all lowcase
|
||||
if (isReservedWord(sanName)) {
|
||||
String modelName = safePrefix + sanName;
|
||||
LOGGER.warn(sanName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", sanName, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (sanName.matches("^\\d.*")) {
|
||||
String modelName = safePrefix + sanName; // e.g. 200Response => Model200Response
|
||||
LOGGER.warn(sanName + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", sanName,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
if (languageSpecificPrimitives.contains(sanName)) {
|
||||
String modelName = safePrefix + sanName;
|
||||
LOGGER.warn(sanName + " (model name matches existing language type) cannot be used as a model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name matches existing language type) cannot be used as a model name. Renamed to {}",
|
||||
sanName, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@@ -860,7 +862,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
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());
|
||||
|
||||
@@ -301,14 +301,15 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
String modelName = "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;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
String modelName = "Model" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@@ -398,7 +399,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
String newOperationId = camelize("call_" + operationId, true);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
|
||||
String includeStatement = "include::{" + attributePathReference + "}" + escapeCurlyBrackets(relativeFileName) + "[opts=optional]";
|
||||
if (Files.isRegularFile(filePathToInclude)) {
|
||||
LOGGER.debug("including " + ++includeCount + ". file into markup from: " + filePathToInclude.toString());
|
||||
LOGGER.debug("including {}. file into markup from: {}", ++includeCount, filePathToInclude.toString());
|
||||
out.write("\n" + includeStatement + "\n");
|
||||
} else {
|
||||
LOGGER.debug(++notFoundCount + ". file not found, skip include for: " + filePathToInclude.toString());
|
||||
LOGGER.debug("{}. file not found, skip include for: {}", ++notFoundCount, filePathToInclude.toString());
|
||||
out.write("\n// markup not found, no " + includeStatement + "\n");
|
||||
}
|
||||
}
|
||||
@@ -140,10 +140,10 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
final Path filePathToLinkTo = Paths.get(basePath, relativeFileName).toAbsolutePath();
|
||||
|
||||
if (Files.isRegularFile(filePathToLinkTo)) {
|
||||
LOGGER.debug("linking " + ++linkedCount + ". file into markup from: " + filePathToLinkTo.toString());
|
||||
LOGGER.debug("linking {}. file into markup from: {}", ++linkedCount, filePathToLinkTo.toString());
|
||||
out.write("\n" + linkName + " link:" + relativeFileName + "[]\n");
|
||||
} else {
|
||||
LOGGER.debug(++notFoundLinkCount + ". file not found, skip link for: " + filePathToLinkTo.toString());
|
||||
LOGGER.debug("{}. file not found, skip link for: {}", ++notFoundLinkCount, filePathToLinkTo.toString());
|
||||
out.write("\n// file not found, no " + linkName + " link :" + relativeFileName + "[]\n");
|
||||
}
|
||||
}
|
||||
@@ -324,8 +324,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
|
||||
String specDir = this.additionalProperties.get(SPEC_DIR) + "";
|
||||
if (!Files.isDirectory(Paths.get(specDir))) {
|
||||
LOGGER.warn("base part for include markup lambda not found: " + specDir + " as "
|
||||
+ Paths.get(specDir).toAbsolutePath());
|
||||
LOGGER.warn("base part for include markup lambda not found: {} as {}", specDir, Paths.get(specDir).toAbsolutePath());
|
||||
}
|
||||
|
||||
this.includeSpecMarkupLambda = new IncludeMarkupLambda(SPEC_DIR,specDir);
|
||||
@@ -333,8 +332,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
||||
|
||||
String snippetDir = this.additionalProperties.get(SNIPPET_DIR) + "";
|
||||
if (!Files.isDirectory(Paths.get(snippetDir))) {
|
||||
LOGGER.warn("base part for include markup lambda not found: " + snippetDir + " as "
|
||||
+ Paths.get(snippetDir).toAbsolutePath());
|
||||
LOGGER.warn("base part for include markup lambda not found: {} as {}", snippetDir, Paths.get(snippetDir).toAbsolutePath());
|
||||
}
|
||||
|
||||
this.includeSnippetMarkupLambda = new IncludeMarkupLambda(SNIPPET_DIR,snippetDir);
|
||||
|
||||
@@ -443,7 +443,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
String original = operation.path;
|
||||
operation.path = operation.path.replace("?", "/");
|
||||
if (!original.equals(operation.path)) {
|
||||
LOGGER.warn("Normalized " + original + " to " + operation.path + ". Please verify generated source.");
|
||||
LOGGER.warn("Normalized {} to {}. Please verify generated source.", original, operation.path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
if ("abstract".equals(classModifier.getOptValue())) {
|
||||
operationModifier.setOptValue(classModifier.getOptValue());
|
||||
additionalProperties.put(OPERATION_MODIFIER, operationModifier.getOptValue());
|
||||
LOGGER.warn("classModifier is " + classModifier.getOptValue() + " so forcing operatonModifier to " + operationModifier.getOptValue());
|
||||
LOGGER.warn("classModifier is {} so forcing operatonModifier to {}", classModifier.getOptValue(), operationModifier.getOptValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
if ("abstract".equals(operationModifier.getOptValue())) {
|
||||
generateBody = false;
|
||||
additionalProperties.put(GENERATE_BODY, generateBody);
|
||||
LOGGER.warn("operationModifier is " + operationModifier.getOptValue() + " so forcing generateBody to " + generateBody);
|
||||
LOGGER.warn("operationModifier is {} so forcing generateBody to {}", operationModifier.getOptValue(), generateBody);
|
||||
} else if (additionalProperties.containsKey(GENERATE_BODY)) {
|
||||
generateBody = convertPropertyToBooleanAndWriteBack(GENERATE_BODY);
|
||||
} else {
|
||||
@@ -593,7 +593,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
if (isLibrary) {
|
||||
modelClassModifier.setOptValue("");
|
||||
additionalProperties.put(MODEL_CLASS_MODIFIER, modelClassModifier.getOptValue());
|
||||
LOGGER.warn("buildTarget is " + buildTarget.getOptValue() + " so removing any modelClassModifier ");
|
||||
LOGGER.warn("buildTarget is {} so removing any modelClassModifier ", buildTarget.getOptValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -622,7 +622,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
// default, do nothing
|
||||
compatibilityVersion = "Version_" + aspnetCoreVersion.getOptValue().replace(".", "_");
|
||||
}
|
||||
LOGGER.info("ASP.NET core version: " + aspnetCoreVersion.getOptValue());
|
||||
LOGGER.info("ASP.NET core version: {}", aspnetCoreVersion.getOptValue());
|
||||
if(!additionalProperties.containsKey(CodegenConstants.TEMPLATE_DIR)){
|
||||
templateDir = embeddedTemplateDir = "aspnetcore" + File.separator + determineTemplateVersion(aspnetCoreVersion.getOptValue());
|
||||
}
|
||||
@@ -660,7 +660,8 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
private void setNullableReferenceTypes() {
|
||||
if (additionalProperties.containsKey(NULLABLE_REFERENCE_TYPES)) {
|
||||
if (aspnetCoreVersion.getOptValue().startsWith("2.")) {
|
||||
LOGGER.warn("Nullable annotation are not supported in ASP.NET core version 2. Setting " + NULLABLE_REFERENCE_TYPES + " to false");
|
||||
LOGGER.warn("Nullable annotation are not supported in ASP.NET core version 2. Setting {} to false",
|
||||
NULLABLE_REFERENCE_TYPES);
|
||||
additionalProperties.put(NULLABLE_REFERENCE_TYPES, false);
|
||||
} else {
|
||||
nullableReferenceTypes = convertPropertyToBooleanAndWriteBack(NULLABLE_REFERENCE_TYPES);
|
||||
@@ -683,12 +684,16 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
private void setIsFramework() {
|
||||
if (aspnetCoreVersion.getOptValue().startsWith("3.")) {// default, do nothing
|
||||
LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so changing to use frameworkReference instead of packageReference ");
|
||||
LOGGER.warn(
|
||||
"ASP.NET core version is {} so changing to use frameworkReference instead of packageReference ",
|
||||
aspnetCoreVersion.getOptValue());
|
||||
useFrameworkReference = true;
|
||||
additionalProperties.put(USE_FRAMEWORK_REFERENCE, useFrameworkReference);
|
||||
additionalProperties.put(TARGET_FRAMEWORK, "netcoreapp" + aspnetCoreVersion.getOptValue());
|
||||
} else if (aspnetCoreVersion.getOptValue().startsWith("5.")) {// default, do nothing
|
||||
LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so changing to use frameworkReference instead of packageReference ");
|
||||
LOGGER.warn(
|
||||
"ASP.NET core version is {} so changing to use frameworkReference instead of packageReference ",
|
||||
aspnetCoreVersion.getOptValue());
|
||||
useFrameworkReference = true;
|
||||
additionalProperties.put(USE_FRAMEWORK_REFERENCE, useFrameworkReference);
|
||||
additionalProperties.put(TARGET_FRAMEWORK, "net5.0");
|
||||
@@ -705,7 +710,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
private void setUseNewtonsoft() {
|
||||
if (aspnetCoreVersion.getOptValue().startsWith("2.")) {
|
||||
LOGGER.warn("ASP.NET core version 2.X support has been deprecated. Please use ASP.NET core version 3.1 instead");
|
||||
LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so staying on default json library.");
|
||||
LOGGER.warn("ASP.NET core version is {} so staying on default json library.", aspnetCoreVersion.getOptValue());
|
||||
useNewtonsoft = false;
|
||||
additionalProperties.put(USE_NEWTONSOFT, useNewtonsoft);
|
||||
} else {
|
||||
@@ -719,7 +724,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
private void setUseEndpointRouting() {
|
||||
if (aspnetCoreVersion.getOptValue().startsWith("3.") || aspnetCoreVersion.getOptValue().startsWith("5.")) {
|
||||
LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so switching to old style endpoint routing.");
|
||||
LOGGER.warn("ASP.NET core version is {} so switching to old style endpoint routing.", aspnetCoreVersion.getOptValue());
|
||||
useDefaultRouting = false;
|
||||
additionalProperties.put(USE_DEFAULT_ROUTING, useDefaultRouting);
|
||||
} else {
|
||||
@@ -735,12 +740,12 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
setCliOption(swashbuckleVersion);
|
||||
|
||||
if (aspnetCoreVersion.getOptValue().startsWith("3.") || aspnetCoreVersion.getOptValue().startsWith("5.")) {
|
||||
LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so changing default Swashbuckle version to 5.0.0.");
|
||||
LOGGER.warn("ASP.NET core version is {} so changing default Swashbuckle version to 5.0.0.", aspnetCoreVersion.getOptValue());
|
||||
swashbuckleVersion.setOptValue("5.0.0");
|
||||
additionalProperties.put(SWASHBUCKLE_VERSION, swashbuckleVersion.getOptValue());
|
||||
} else {
|
||||
// default, do nothing
|
||||
LOGGER.info("Swashbuckle version: " + swashbuckleVersion.getOptValue());
|
||||
LOGGER.info("Swashbuckle version: {}", swashbuckleVersion.getOptValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user