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

This commit is contained in:
wing328
2016-11-09 16:37:11 +08:00
158 changed files with 1842 additions and 1165 deletions

View File

@@ -1892,7 +1892,11 @@ public class DefaultCodegen {
for (String key : consumes) {
Map<String, String> mediaType = new HashMap<String, String>();
// escape quotation to avoid code injection
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
if ("*/*".equals(key)) { // "*/*" is a special case, do nothing
mediaType.put("mediaType", key);
} else {
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
}
count += 1;
if (count < consumes.size()) {
mediaType.put("hasMore", "true");
@@ -1926,7 +1930,11 @@ public class DefaultCodegen {
for (String key : produces) {
Map<String, String> mediaType = new HashMap<String, String>();
// escape quotation to avoid code injection
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
if ("*/*".equals(key)) { // "*/*" is a special case, do nothing
mediaType.put("mediaType", key);
} else {
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
}
count += 1;
if (count < produces.size()) {
mediaType.put("hasMore", "true");

View File

@@ -141,7 +141,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
config.additionalProperties().put("generatedDate", DateTime.now().toString());
config.additionalProperties().put("generatorClass", config.getClass().toString());
config.additionalProperties().put("inputSpec", config.getInputSpec());
if (swagger.getInfo() != null) {
Info info = swagger.getInfo();
if (info.getTitle() != null) {
@@ -405,6 +405,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
operation.put("classname", config.toApiName(tag));
operation.put("classVarName", config.toApiVarName(tag));
operation.put("importPath", config.toApiImport(tag));
operation.put("classFilename", config.toApiFilename(tag));
if(!config.vendorExtensions().isEmpty()) {
operation.put("vendorExtensions", config.vendorExtensions());

View File

@@ -291,7 +291,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
typeMapping.put("DateTime", "OffsetDateTime");
importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
}
} else {
} else if (dateLibrary.equals("legacy")) {
additionalProperties.put("legacyDates", "true");
}
}

View File

@@ -139,8 +139,11 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
}
}
}
if ( operation.returnType == null ) {
operation.returnType = "void";
// set vendorExtensions.x-java-is-response-void to true as returnType is set to "void"
operation.vendorExtensions.put("x-java-is-response-void", true);
} else if ( operation.returnType.startsWith("List") ) {
String rt = operation.returnType;
int end = rt.lastIndexOf(">");

View File

@@ -10,6 +10,8 @@ public class AspNet5ServerCodegen extends AspNetCoreServerCodegen {
public AspNet5ServerCodegen() {
super();
embeddedTemplateDir = templateDir = "aspnetcore";
}
@Override

View File

@@ -136,8 +136,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen implements BeanValida
}
if ("feign".equals(getLibrary())) {
supportingFiles.add(new SupportingFile("FormAwareEncoder.mustache", invokerFolder, "FormAwareEncoder.java"));
additionalProperties.put("jackson", "true");
supportingFiles.add(new SupportingFile("ParamExpander.mustache", invokerFolder, "ParamExpander.java"));
} else if ("okhttp-gson".equals(getLibrary()) || StringUtils.isEmpty(getLibrary())) {
// the "okhttp-gson" library template requires "ApiCallback.mustache" for async call
supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java"));