forked from loafle/openapi-generator-original
better warning, default value (#1492)
This commit is contained in:
parent
b9949e1a8e
commit
363b095721
@ -297,8 +297,12 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
}
|
||||
if (projectDescription == null) {
|
||||
// when projectDescription is not specified, use info.description
|
||||
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
|
||||
if (additionalProperties.get(CodegenConstants.LICENSE_NAME) == null && info.getLicense() != null) {
|
||||
@ -506,11 +510,16 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
|
||||
private String getNameUsingModelPropertyNaming(String name) {
|
||||
switch (CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.valueOf(getModelPropertyNaming())) {
|
||||
case original: return name;
|
||||
case camelCase: return org.openapitools.codegen.utils.StringUtils.camelize(name, true);
|
||||
case PascalCase: return org.openapitools.codegen.utils.StringUtils.camelize(name);
|
||||
case snake_case: return org.openapitools.codegen.utils.StringUtils.underscore(name);
|
||||
default: throw new IllegalArgumentException("Invalid model property naming '" +
|
||||
case original:
|
||||
return name;
|
||||
case camelCase:
|
||||
return org.openapitools.codegen.utils.StringUtils.camelize(name, true);
|
||||
case PascalCase:
|
||||
return org.openapitools.codegen.utils.StringUtils.camelize(name);
|
||||
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'");
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class URLPathUtils {
|
||||
LOGGER.warn("'scheme' not defined in the spec (2.0). Default to [http] for server URL [{}]", url);
|
||||
} else if (url.startsWith("/")) {
|
||||
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.+\\-]+://.+")) {
|
||||
// Add http scheme for urls without a scheme.
|
||||
// 2.0 spec is restricted to the following schemes: "http", "https", "ws", "wss"
|
||||
|
Loading…
x
Reference in New Issue
Block a user