Update default value, fix example value (#370)

* fix python flask NPE with oas3

* update perl default value, fix example value

* update android sample, fix example value

* restore x-swagger-router-controller for nodejs server generator

* update default value for bash client, fix example value, invalid tag

* update default value for objc

* update objc pestore core data
This commit is contained in:
William Cheng
2018-05-08 19:51:15 +08:00
committed by GitHub
parent fd3b883e80
commit 0d20f75afc
61 changed files with 475 additions and 571 deletions

View File

@@ -4240,7 +4240,6 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.paramName = toParamName(codegenParameter.baseName);
codegenParameter.items = codegenProperty.items;
codegenParameter.dataType = getTypeDeclaration(schema);
LOGGER.info("debugging inline map: " + codegenParameter.dataType);
codegenParameter.baseType = getSchemaType(inner);
codegenParameter.isContainer = Boolean.TRUE;
codegenParameter.isMapContainer = Boolean.TRUE;

View File

@@ -289,7 +289,8 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
p.example = p.defaultValue;
return;
}
String type = p.baseType;

View File

@@ -691,7 +691,8 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
p.example = p.defaultValue;
return;
}
String type = p.baseType;

View File

@@ -393,8 +393,8 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig
operation.setOperationId(getOrGenerateOperationId(operation, pathname, method.toString()));
}
if (operation.getExtensions() == null ||
operation.getExtensions().get("x-openapi-router-controller") == null) {
operation.addExtension("x-openapi-router-controller", sanitizeTag(tag));
operation.getExtensions().get("x-swagger-router-controller") == null) {
operation.addExtension("x-swagger-router-controller", sanitizeTag(tag));
}
}
}

View File

@@ -56,7 +56,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
protected Set<String> foundationClasses = new HashSet<String>();
protected String podName = "OpenAPIClient";
protected String podVersion = "1.0.0";
protected String classPrefix = "SWG";
protected String classPrefix = "OAI";
protected String authorName = "OpenAPI";
protected String authorEmail = "team@openapitools.org";
protected String license = DEFAULT_LICENSE;
@@ -141,7 +141,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
typeMapping.put("List", "NSArray");
typeMapping.put("object", "NSObject");
typeMapping.put("file", "NSURL");
typeMapping.put("binary", "NSData");
typeMapping.put("binary", "NSURL");
typeMapping.put("bytearray", "NSData");
typeMapping.put("byte", "NSData");
typeMapping.put("uuid", "NSString");
@@ -189,7 +189,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
cliOptions.clear();
cliOptions.add(new CliOption(CORE_DATA, "Should generate core data models").defaultValue("false"));
cliOptions.add(new CliOption(CLASS_PREFIX, "prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`).`")
.defaultValue("SWG"));
.defaultValue("OAI"));
cliOptions.add(new CliOption(POD_NAME, "cocoapods package name (convention: CameCase).")
.defaultValue("OpenAPIClient"));
cliOptions.add(new CliOption(CodegenConstants.POD_VERSION, "cocoapods package version.")
@@ -698,7 +698,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
p.example = p.defaultValue;
return;
}
String type = p.baseType;

View File

@@ -400,7 +400,8 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
p.example = p.defaultValue;
return;
}
String type = p.baseType;

View File

@@ -330,7 +330,7 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
operationId = getOrGenerateOperationId(operation, pathname, method.toString());
}
operation.setOperationId(toOperationId(operationId));
if (operation.getExtensions().get("x-openapi-router-controller") == null) {
if (operation.getExtensions() == null || operation.getExtensions().get("x-openapi-router-controller") == null) {
operation.addExtension(
"x-openapi-router-controller",
controllerPackage + "." + toApiFilename(tag)
@@ -526,7 +526,8 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
p.example = p.defaultValue;
return;
}
String type = p.baseType;