Merge remote-tracking branch 'origin/master' into 2.3.0

This commit is contained in:
wing328
2017-04-10 23:32:06 +08:00
14 changed files with 78 additions and 25 deletions

View File

@@ -12,9 +12,6 @@ public class CodegenParameter {
public String baseName, paramName, dataType, datatypeWithEnum, dataFormat,
collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName;
//This was added for javaPlayFramework specifically to get around a bug in swagger-play. See generator for more info on the bug.
public String dataTypeForImplicitParam;
public String example; // example value (x-example)
public String jsonSchema;
public boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime;

View File

@@ -188,6 +188,9 @@ public class JavaPlayFrameworkCodegen extends AbstractJavaCodegen implements Bea
typeMapping.put("DateTime", "OffsetDateTime");
importMapping.put("LocalDate", "java.time.LocalDate");
importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
importMapping.put("InputStream", "java.io.InputStream");
typeMapping.put("file", "InputStream");
}
@Override
@@ -249,17 +252,15 @@ public class JavaPlayFrameworkCodegen extends AbstractJavaCodegen implements Bea
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
for (CodegenOperation operation : ops) {
//This is to fix this bug in the swagger-play project: https://github.com/swagger-api/swagger-play/issues/131
//We need to explicitly add the model package name in front of the dataType because if we don't, the
//implicitParam is not valid and show error when loading the documentation
//This can be removed safely after the bug has been fixed
for (CodegenParameter param : operation.allParams) {
if (!param.isPathParam ) {
if (!param.isPrimitiveType && !param.isListContainer && !param.isMapContainer) {
param.dataTypeForImplicitParam = String.format("%s.%s", modelPackage, param.dataType);
} else {
param.dataTypeForImplicitParam = param.dataType;
}
if (param.isFormParam && param.isFile) {
param.dataType = "Http.MultipartFormData.FilePart";
}
}
for (CodegenParameter param : operation.formParams) {
if (param.isFile) {
param.dataType = "Http.MultipartFormData.FilePart";
}
}