forked from loafle/openapi-generator-original
better logging (#9090)
This commit is contained in:
parent
e71ae12e14
commit
854296634a
@ -385,14 +385,14 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
// model name cannot use reserved keyword, e.g. return
|
// model name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(camelizedName)) {
|
if (isReservedWord(camelizedName)) {
|
||||||
final String modelName = "Model" + 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;
|
return modelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// model name starts with number
|
// model name starts with number
|
||||||
if (camelizedName.matches("^\\d.*")) {
|
if (camelizedName.matches("^\\d.*")) {
|
||||||
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
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;
|
return modelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
public String getSchemaType(Schema p) {
|
public String getSchemaType(Schema p) {
|
||||||
String openAPIType = super.getSchemaType(p);
|
String openAPIType = super.getSchemaType(p);
|
||||||
if (openAPIType == null) {
|
if (openAPIType == null) {
|
||||||
LOGGER.error("No Type defined for Schema " + p);
|
LOGGER.error("No Type defined for Schema {}", p);
|
||||||
}
|
}
|
||||||
if (typeMapping.containsKey(openAPIType)) {
|
if (typeMapping.containsKey(openAPIType)) {
|
||||||
return typeMapping.get(openAPIType);
|
return typeMapping.get(openAPIType);
|
||||||
@ -601,13 +601,13 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
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;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + operationId), true);
|
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize("call_" + operationId), true);
|
||||||
operationId = camelize("call_" + operationId, true);
|
operationId = camelize("call_" + operationId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user