forked from loafle/openapi-generator-original
better warning, default value (#1492)
This commit is contained in:
parent
b9949e1a8e
commit
363b095721
@ -297,7 +297,11 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
}
|
}
|
||||||
if (projectDescription == null) {
|
if (projectDescription == null) {
|
||||||
// when projectDescription is not specified, use info.description
|
// when projectDescription is not specified, use info.description
|
||||||
projectDescription = sanitizeName(info.getDescription());
|
if (StringUtils.isEmpty(info.getDescription())) {
|
||||||
|
projectDescription = "JS API client generated by OpenAPI Generator";
|
||||||
|
} else {
|
||||||
|
projectDescription = sanitizeName(info.getDescription());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// when licenceName is not specified, use info.license
|
// when licenceName is not specified, use info.license
|
||||||
@ -506,13 +510,18 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
|
|
||||||
private String getNameUsingModelPropertyNaming(String name) {
|
private String getNameUsingModelPropertyNaming(String name) {
|
||||||
switch (CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.valueOf(getModelPropertyNaming())) {
|
switch (CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.valueOf(getModelPropertyNaming())) {
|
||||||
case original: return name;
|
case original:
|
||||||
case camelCase: return org.openapitools.codegen.utils.StringUtils.camelize(name, true);
|
return name;
|
||||||
case PascalCase: return org.openapitools.codegen.utils.StringUtils.camelize(name);
|
case camelCase:
|
||||||
case snake_case: return org.openapitools.codegen.utils.StringUtils.underscore(name);
|
return org.openapitools.codegen.utils.StringUtils.camelize(name, true);
|
||||||
default: throw new IllegalArgumentException("Invalid model property naming '" +
|
case PascalCase:
|
||||||
name + "'. Must be 'original', 'camelCase', " +
|
return org.openapitools.codegen.utils.StringUtils.camelize(name);
|
||||||
"'PascalCase' or 'snake_case'");
|
case snake_case:
|
||||||
|
return org.openapitools.codegen.utils.StringUtils.underscore(name);
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Invalid model property naming '" +
|
||||||
|
name + "'. Must be 'original', 'camelCase', " +
|
||||||
|
"'PascalCase' or 'snake_case'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,7 +880,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
codegenModel.getVendorExtensions().put("x-itemType", getSchemaType(ModelUtils.getAdditionalProperties(model)));
|
codegenModel.getVendorExtensions().put("x-itemType", getSchemaType(ModelUtils.getAdditionalProperties(model)));
|
||||||
} else {
|
} else {
|
||||||
String type = model.getType();
|
String type = model.getType();
|
||||||
if (isPrimitiveType(type)){
|
if (isPrimitiveType(type)) {
|
||||||
codegenModel.vendorExtensions.put("x-isPrimitive", true);
|
codegenModel.vendorExtensions.put("x-isPrimitive", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ public class URLPathUtils {
|
|||||||
LOGGER.warn("'scheme' not defined in the spec (2.0). Default to [http] for server URL [{}]", url);
|
LOGGER.warn("'scheme' not defined in the spec (2.0). Default to [http] for server URL [{}]", url);
|
||||||
} else if (url.startsWith("/")) {
|
} else if (url.startsWith("/")) {
|
||||||
url = LOCAL_HOST + url;
|
url = LOCAL_HOST + url;
|
||||||
LOGGER.warn("'host' not defined in the spec (2.0). Default to [{}] for server URL [{}]", LOCAL_HOST, url);
|
LOGGER.warn("'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [{}] for server URL [{}]", LOCAL_HOST, url);
|
||||||
} else if (!url.matches("[a-zA-Z][0-9a-zA-Z.+\\-]+://.+")) {
|
} else if (!url.matches("[a-zA-Z][0-9a-zA-Z.+\\-]+://.+")) {
|
||||||
// Add http scheme for urls without a scheme.
|
// Add http scheme for urls without a scheme.
|
||||||
// 2.0 spec is restricted to the following schemes: "http", "https", "ws", "wss"
|
// 2.0 spec is restricted to the following schemes: "http", "https", "ws", "wss"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user