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

This commit is contained in:
wing328 2017-05-18 16:22:42 +08:00
commit cc55dfbf13
11 changed files with 20 additions and 5 deletions

View File

@ -170,6 +170,14 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig
return markdownConverter.toHtml(input); return markdownConverter.toHtml(input);
} }
// DefaultCodegen converts model names to UpperCamelCase
// but for static HTML, we want the names to be preserved as coded in the OpenApi
// so HTML links work
@Override
public String toModelName(final String name) {
return name;
}
public void preprocessSwagger(Swagger swagger) { public void preprocessSwagger(Swagger swagger) {
Info info = swagger.getInfo(); Info info = swagger.getInfo();
info.setDescription(toHtml(info.getDescription())); info.setDescription(toHtml(info.getDescription()));

View File

@ -25,6 +25,7 @@ import java.io.InputStream;
{{^supportJava6}} {{^supportJava6}}
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
{{/supportJava6}} {{/supportJava6}}
{{#supportJava6}} {{#supportJava6}}
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
@ -581,7 +582,7 @@ public class ApiClient {
try { try {
File file = prepareDownloadFile(response); File file = prepareDownloadFile(response);
{{^supportJava6}} {{^supportJava6}}
Files.copy(response.readEntity(InputStream.class), file.toPath()); Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
{{/supportJava6}} {{/supportJava6}}
{{#supportJava6}} {{#supportJava6}}
// Java6 falls back to commons.io for file copying // Java6 falls back to commons.io for file copying

View File

@ -0,0 +1 @@
{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}

View File

@ -1 +1 @@
{{! PathParam is always required, no @NotNull necessary }}{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}} {{! PathParam is always required, no @NotNull necessary }}{{>beanValidationCore}}

View File

@ -1 +1 @@
{{#required}} @NotNull{{/required}}{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}} {{#required}} @NotNull {{/required}}{{>beanValidationCore}}

View File

@ -1 +1 @@
{{#isBoolean}}Boolean.getBoolean({{/isBoolean}}{{#isInteger}}Integer.parseInt({{/isInteger}}{{#isDouble}}Double.parseDouble({{/isDouble}}{{#isLong}}Long.parseLong({{/isLong}}{{#isFloat}}Float.parseFloat({{/isFloat}}{{#isString}}(String){{/isString}} {{#isBoolean}}Boolean.valueOf({{/isBoolean}}{{#isInteger}}Integer.parseInt({{/isInteger}}{{#isDouble}}Double.parseDouble({{/isDouble}}{{#isLong}}Long.parseLong({{/isLong}}{{#isFloat}}Float.parseFloat({{/isFloat}}{{#isString}}(String){{/isString}}

View File

@ -0,0 +1 @@
2.2.3-SNAPSHOT

View File

@ -0,0 +1 @@
2.2.3-SNAPSHOT

View File

@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
@ -575,7 +576,7 @@ public class ApiClient {
public File downloadFileFromResponse(Response response) throws ApiException { public File downloadFileFromResponse(Response response) throws ApiException {
try { try {
File file = prepareDownloadFile(response); File file = prepareDownloadFile(response);
Files.copy(response.readEntity(InputStream.class), file.toPath()); Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
return file; return file;
} catch (IOException e) { } catch (IOException e) {
throw new ApiException(e); throw new ApiException(e);

View File

@ -0,0 +1 @@
2.2.3-SNAPSHOT

View File

@ -0,0 +1 @@
2.2.3-SNAPSHOT