From 1e975637c9d67ef96364b5a1d1ba6f176d6116c1 Mon Sep 17 00:00:00 2001 From: walthema Date: Mon, 24 Oct 2016 15:04:55 +0200 Subject: [PATCH 01/16] Fixed enum marshalling & fromValue() Added toString() to enums --- .../resources/JavaJaxRS/cxf/enumClass.mustache | 16 +++++++++++++--- .../main/resources/JavaJaxRS/cxf/pojo.mustache | 1 + .../gen/java/io/swagger/model/Category.java | 1 + .../java/io/swagger/model/ModelApiResponse.java | 1 + .../gen/java/io/swagger/model/Order.java | 17 ++++++++++++++--- .../gen/java/io/swagger/model/Pet.java | 17 ++++++++++++++--- .../gen/java/io/swagger/model/Tag.java | 1 + .../gen/java/io/swagger/model/User.java | 1 + 8 files changed, 46 insertions(+), 9 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/enumClass.mustache index 9421223115..10bb9d0f4e 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/enumClass.mustache @@ -1,9 +1,9 @@ @XmlType(name="{{datatypeWithEnum}}") -@XmlEnum +@XmlEnum({{datatype}}.class) public enum {{datatypeWithEnum}} { {{#allowableValues}} - {{#enumVars}}{{name}}({{datatype}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} + {{#enumVars}}@XmlEnumValue({{{value}}}) {{name}}({{datatype}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} {{/allowableValues}} @@ -17,7 +17,17 @@ public enum {{datatypeWithEnum}} { return value; } + @Override + public String toString() { + return String.valueOf(value); + } + public static {{datatypeWithEnum}} fromValue(String v) { - return valueOf(v); + for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; } } diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache index c214ae2ae8..3734c525a2 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache @@ -4,6 +4,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; @XmlAccessorType(XmlAccessType.FIELD) {{#hasVars}} @XmlType(name = "{{classname}}", propOrder = diff --git a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Category.java index c84e936b3b..ecd7630f6a 100644 --- a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Category.java @@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Category", propOrder = diff --git a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/ModelApiResponse.java index 950307540f..dc8a57cf13 100644 --- a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/ModelApiResponse.java @@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ModelApiResponse", propOrder = diff --git a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Order.java index d3d9ffabfb..ec2140e1b4 100644 --- a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Order.java @@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Order", propOrder = @@ -31,10 +32,10 @@ public class Order { private javax.xml.datatype.XMLGregorianCalendar shipDate = null; @XmlType(name="StatusEnum") -@XmlEnum +@XmlEnum(String.class) public enum StatusEnum { - PLACED(String.valueOf("placed")), APPROVED(String.valueOf("approved")), DELIVERED(String.valueOf("delivered")); + @XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") DELIVERED(String.valueOf("delivered")); private String value; @@ -47,8 +48,18 @@ public enum StatusEnum { return value; } + @Override + public String toString() { + return String.valueOf(value); + } + public static StatusEnum fromValue(String v) { - return valueOf(v); + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; } } diff --git a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Pet.java index 3c1adb7d97..5a636e92c3 100644 --- a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Pet.java @@ -12,6 +12,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Pet", propOrder = @@ -38,10 +39,10 @@ public class Pet { private List tags = new ArrayList(); @XmlType(name="StatusEnum") -@XmlEnum +@XmlEnum(String.class) public enum StatusEnum { - AVAILABLE(String.valueOf("available")), PENDING(String.valueOf("pending")), SOLD(String.valueOf("sold")); + @XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") SOLD(String.valueOf("sold")); private String value; @@ -54,8 +55,18 @@ public enum StatusEnum { return value; } + @Override + public String toString() { + return String.valueOf(value); + } + public static StatusEnum fromValue(String v) { - return valueOf(v); + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(v)) { + return b; + } + } + return null; } } diff --git a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Tag.java index 1eddc2f761..848da3841f 100644 --- a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/Tag.java @@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Tag", propOrder = diff --git a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/User.java index f66d1df57e..e08637a577 100644 --- a/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs-cxf/gen/java/io/swagger/model/User.java @@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "User", propOrder = From 60c7d90d229ee2657bfee9e634cf0622e18a443a Mon Sep 17 00:00:00 2001 From: sanjeewa-malalgoda Date: Thu, 3 Nov 2016 10:39:52 +0530 Subject: [PATCH 02/16] remove glassfish dependencies and use MSF4J internal implementation for the simplicity and reduce dependencies --- .../src/main/resources/MSF4J/api.mustache | 4 ++-- .../src/main/resources/MSF4J/apiService.mustache | 3 ++- .../src/main/resources/MSF4J/apiServiceImpl.mustache | 3 ++- .../src/main/resources/MSF4J/formParams.mustache | 2 +- .../src/main/resources/MSF4J/pom.mustache | 10 ---------- .../main/resources/MSF4J/serviceFormParams.mustache | 2 +- 6 files changed, 8 insertions(+), 16 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/api.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/api.mustache index f90d256418..8a04d1cad7 100644 --- a/modules/swagger-codegen/src/main/resources/MSF4J/api.mustache +++ b/modules/swagger-codegen/src/main/resources/MSF4J/api.mustache @@ -15,8 +15,8 @@ import {{package}}.NotFoundException; import java.io.InputStream; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.FormDataParam; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/apiService.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/apiService.mustache index edaa0f9bec..ca5e8d3496 100644 --- a/modules/swagger-codegen/src/main/resources/MSF4J/apiService.mustache +++ b/modules/swagger-codegen/src/main/resources/MSF4J/apiService.mustache @@ -3,7 +3,8 @@ package {{package}}; import {{package}}.*; import {{modelPackage}}.*; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; {{#imports}}import {{import}}; {{/imports}} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/apiServiceImpl.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/apiServiceImpl.mustache index af1b56fc69..7b66d35361 100644 --- a/modules/swagger-codegen/src/main/resources/MSF4J/apiServiceImpl.mustache +++ b/modules/swagger-codegen/src/main/resources/MSF4J/apiServiceImpl.mustache @@ -11,7 +11,8 @@ import {{package}}.NotFoundException; import java.io.InputStream; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/formParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/formParams.mustache index 9a7ff6ea6c..249266065d 100644 --- a/modules/swagger-codegen/src/main/resources/MSF4J/formParams.mustache +++ b/modules/swagger-codegen/src/main/resources/MSF4J/formParams.mustache @@ -1,3 +1,3 @@ {{#isFormParam}}{{#notFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#vendorExtensions.x-multipart}}@FormDataParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/notFile}}{{#isFile}} @FormDataParam("{{paramName}}") InputStream {{paramName}}InputStream, - @FormDataParam("{{paramName}}") FormDataContentDisposition {{paramName}}Detail{{/isFile}}{{/isFormParam}} + @FormDataParam("{{paramName}}") FileInfo {{paramName}}Detail{{/isFile}}{{/isFormParam}} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/pom.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/pom.mustache index ff9764e8e9..7839f9c1ec 100644 --- a/modules/swagger-codegen/src/main/resources/MSF4J/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/MSF4J/pom.mustache @@ -66,16 +66,6 @@ jackson-datatype-joda 2.4.1 - - org.glassfish.jersey.containers - jersey-container-servlet-core - ${jersey2-version} - - - org.glassfish.jersey.media - jersey-media-multipart - ${jersey2-version} - diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/serviceFormParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/serviceFormParams.mustache index dc2d2eb1ec..c58393551d 100644 --- a/modules/swagger-codegen/src/main/resources/MSF4J/serviceFormParams.mustache +++ b/modules/swagger-codegen/src/main/resources/MSF4J/serviceFormParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}InputStream {{paramName}}InputStream, FormDataContentDisposition {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}InputStream {{paramName}}InputStream, FileInfo {{paramName}}Detail{{/isFile}}{{/isFormParam}} From 096cbd57f51731f2b996e35fed2dbec938923554 Mon Sep 17 00:00:00 2001 From: Anton WIMMER Date: Fri, 4 Nov 2016 11:47:44 +0100 Subject: [PATCH 03/16] fix[dart]: multi-word class names work properly now --- .../src/main/java/io/swagger/codegen/DefaultGenerator.java | 3 ++- .../swagger-codegen/src/main/resources/dart/apilib.mustache | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index fd893f5d52..a2e7f597c4 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -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()); diff --git a/modules/swagger-codegen/src/main/resources/dart/apilib.mustache b/modules/swagger-codegen/src/main/resources/dart/apilib.mustache index f608cf214e..07b02ef610 100644 --- a/modules/swagger-codegen/src/main/resources/dart/apilib.mustache +++ b/modules/swagger-codegen/src/main/resources/dart/apilib.mustache @@ -16,7 +16,7 @@ part 'auth/api_key_auth.dart'; part 'auth/oauth.dart'; part 'auth/http_basic_auth.dart'; -{{#apiInfo}}{{#apis}}part 'api/{{classVarName}}_api.dart'; +{{#apiInfo}}{{#apis}}part 'api/{{classFilename}}.dart'; {{/apis}}{{/apiInfo}} {{#models}}{{#model}}part 'model/{{classFilename}}.dart'; {{/model}}{{/models}} From 901a981f2614500775be8a2faab0bb12c2dff6f0 Mon Sep 17 00:00:00 2001 From: Christophe Bornet Date: Fri, 4 Nov 2016 14:13:18 +0100 Subject: [PATCH 04/16] [feign] Use feign-form (#4124) * [feign] Use feign-form Fix #4108 * [feign] Convert java.util.Date params to rfc3339 with an Expander --- .../languages/AbstractJavaCodegen.java | 5 +- .../codegen/languages/JavaClientCodegen.java | 2 +- .../Java/libraries/feign/ApiClient.mustache | 3 +- .../libraries/feign/FormAwareEncoder.mustache | 192 ------------------ .../libraries/feign/ParamExpander.mustache | 22 ++ .../Java/libraries/feign/api.mustache | 7 +- .../libraries/feign/build.gradle.mustache | 2 + .../Java/libraries/feign/build.sbt.mustache | 1 + .../Java/libraries/feign/pom.mustache | 6 + .../client/petstore/java/feign/build.gradle | 2 + samples/client/petstore/java/feign/build.sbt | 1 + .../client/petstore/java/feign/gradlew.bat | 180 ++++++++-------- samples/client/petstore/java/feign/pom.xml | 6 + .../java/io/swagger/client/ApiClient.java | 3 +- .../io/swagger/client/FormAwareEncoder.java | 192 ------------------ .../java/io/swagger/client/ParamExpander.java | 22 ++ .../io/swagger/client/RFC3339DateFormat.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 9 +- .../java/io/swagger/client/api/PetApi.java | 16 +- .../java/io/swagger/client/api/StoreApi.java | 8 +- .../java/io/swagger/client/api/UserApi.java | 16 +- .../model/AdditionalPropertiesClass.java | 5 +- .../java/io/swagger/client/model/Animal.java | 5 +- .../io/swagger/client/model/AnimalFarm.java | 5 +- .../model/ArrayOfArrayOfNumberOnly.java | 5 +- .../client/model/ArrayOfNumberOnly.java | 5 +- .../io/swagger/client/model/ArrayTest.java | 5 +- .../java/io/swagger/client/model/Cat.java | 5 +- .../io/swagger/client/model/Category.java | 5 +- .../java/io/swagger/client/model/Client.java | 5 +- .../java/io/swagger/client/model/Dog.java | 5 +- .../io/swagger/client/model/EnumArrays.java | 5 +- .../io/swagger/client/model/EnumClass.java | 1 - .../io/swagger/client/model/EnumTest.java | 5 +- .../io/swagger/client/model/FormatTest.java | 5 +- .../swagger/client/model/HasOnlyReadOnly.java | 5 +- .../java/io/swagger/client/model/MapTest.java | 5 +- ...ropertiesAndAdditionalPropertiesClass.java | 5 +- .../client/model/Model200Response.java | 5 +- .../client/model/ModelApiResponse.java | 5 +- .../io/swagger/client/model/ModelReturn.java | 5 +- .../java/io/swagger/client/model/Name.java | 5 +- .../io/swagger/client/model/NumberOnly.java | 5 +- .../java/io/swagger/client/model/Order.java | 5 +- .../java/io/swagger/client/model/Pet.java | 5 +- .../swagger/client/model/ReadOnlyFirst.java | 5 +- .../client/model/SpecialModelName.java | 5 +- .../java/io/swagger/client/model/Tag.java | 5 +- .../java/io/swagger/client/model/User.java | 5 +- 49 files changed, 272 insertions(+), 561 deletions(-) delete mode 100644 modules/swagger-codegen/src/main/resources/Java/libraries/feign/FormAwareEncoder.mustache create mode 100644 modules/swagger-codegen/src/main/resources/Java/libraries/feign/ParamExpander.mustache delete mode 100644 samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java create mode 100644 samples/client/petstore/java/feign/src/main/java/io/swagger/client/ParamExpander.java diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java index 052a0f8231..5327a4e84c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java @@ -273,8 +273,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code importMapping.put("LocalDate", "org.joda.time.LocalDate"); importMapping.put("DateTime", "org.joda.time.DateTime"); - } - else if (dateLibrary.startsWith("java8")) { + } else if (dateLibrary.startsWith("java8")) { additionalProperties.put("java8", "true"); typeMapping.put("date", "LocalDate"); importMapping.put("LocalDate", "java.time.LocalDate"); @@ -285,6 +284,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code typeMapping.put("DateTime", "OffsetDateTime"); importMapping.put("OffsetDateTime", "java.time.OffsetDateTime"); } + } else if (dateLibrary.equals("legacy")) { + additionalProperties.put("legacyDates", "true"); } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 2887e8d54c..3c574ccebb 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -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")); diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache index 5641afe195..0a92f42cf7 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache @@ -18,6 +18,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import feign.Feign; import feign.RequestInterceptor; +import feign.form.FormEncoder; import feign.jackson.JacksonDecoder; import feign.jackson.JacksonEncoder; import feign.slf4j.Slf4jLogger; @@ -37,7 +38,7 @@ public class ApiClient { objectMapper = createObjectMapper(); apiAuthorizations = new LinkedHashMap(); feignBuilder = Feign.builder() - .encoder(new FormAwareEncoder(new JacksonEncoder(objectMapper))) + .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) .decoder(new JacksonDecoder(objectMapper)) .logger(new Slf4jLogger()); } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/FormAwareEncoder.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/FormAwareEncoder.mustache deleted file mode 100644 index baf29b5f4d..0000000000 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/FormAwareEncoder.mustache +++ /dev/null @@ -1,192 +0,0 @@ -package {{invokerPackage}}; - -import java.io.*; -import java.lang.reflect.Type; -import java.net.URLEncoder; -import java.net.URLConnection; -import java.nio.charset.Charset; -import java.util.*; - -import java.text.DateFormat; - -import feign.codec.EncodeException; -import feign.codec.Encoder; -import feign.RequestTemplate; - -{{>generatedAnnotation}} -public class FormAwareEncoder implements Encoder { - public static final String UTF_8 = "utf-8"; - private static final String LINE_FEED = "\r\n"; - private static final String TWO_DASH = "--"; - private static final String BOUNDARY = "----------------314159265358979323846"; - - private byte[] lineFeedBytes; - private byte[] boundaryBytes; - private byte[] twoDashBytes; - private byte[] atBytes; - private byte[] eqBytes; - - private final Encoder delegate; - private final DateFormat dateFormat; - - public FormAwareEncoder(Encoder delegate) { - this.delegate = delegate; - this.dateFormat = new RFC3339DateFormat();; - - try { - this.lineFeedBytes = LINE_FEED.getBytes(UTF_8); - this.boundaryBytes = BOUNDARY.getBytes(UTF_8); - this.twoDashBytes = TWO_DASH.getBytes(UTF_8); - this.atBytes = "&".getBytes(UTF_8); - this.eqBytes = "=".getBytes(UTF_8); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - } - - public void encode(Object object, Type bodyType, RequestTemplate template) throws EncodeException { - if (object instanceof Map) { - try { - encodeFormParams(template, (Map) object); - } catch (IOException e) { - throw new EncodeException("Failed to create request", e); - } - } else { - delegate.encode(object, bodyType, template); - } - } - - private void encodeFormParams(RequestTemplate template, Map formParams) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - boolean isMultiPart = isMultiPart(formParams); - boolean isFirstField = true; - for (Map.Entry param : formParams.entrySet()) { - String keyStr = param.getKey(); - if (param.getValue() instanceof File) { - addFilePart(baos, keyStr, (File) param.getValue()); - } else { - String valueStr = parameterToString(param.getValue()); - if (isMultiPart) { - addMultiPartFormField(baos, keyStr, valueStr); - } else { - addEncodedFormField(baos, keyStr, valueStr, isFirstField); - isFirstField = false; - } - } - } - - if (isMultiPart) { - baos.write(lineFeedBytes); - baos.write(twoDashBytes); - baos.write(boundaryBytes); - baos.write(twoDashBytes); - baos.write(lineFeedBytes); - } - - String contentType = isMultiPart ? "multipart/form-data; boundary=" + BOUNDARY : "application/x-www-form-urlencoded"; - template.header("Content-type"); - template.header("Content-type", contentType); - template.header("MIME-Version", "1.0"); - template.body(baos.toByteArray(), Charset.forName(UTF_8)); - } - - /* - * Currently only supports text files - */ - private void addFilePart(ByteArrayOutputStream baos, String fieldName, File uploadFile) throws IOException { - String fileName = uploadFile.getName(); - baos.write(twoDashBytes); - baos.write(boundaryBytes); - baos.write(lineFeedBytes); - - String contentDisposition = "Content-Disposition: form-data; name=\"" + fieldName - + "\"; filename=\"" + fileName + "\""; - baos.write(contentDisposition.getBytes(UTF_8)); - baos.write(lineFeedBytes); - String contentType = "Content-Type: " + URLConnection.guessContentTypeFromName(fileName); - baos.write(contentType.getBytes(UTF_8)); - baos.write(lineFeedBytes); - baos.write(lineFeedBytes); - - BufferedReader reader = new BufferedReader(new FileReader(uploadFile)); - InputStream input = new FileInputStream(uploadFile); - byte[] bytes = new byte[4096]; - int len = bytes.length; - while ((len = input.read(bytes)) != -1) { - baos.write(bytes, 0, len); - baos.write(lineFeedBytes); - } - - baos.write(lineFeedBytes); - } - - private void addEncodedFormField(ByteArrayOutputStream baos, String name, String value, boolean isFirstField) throws IOException { - if (!isFirstField) { - baos.write(atBytes); - } - - String encodedName = URLEncoder.encode(name, UTF_8); - String encodedValue = URLEncoder.encode(value, UTF_8); - baos.write(encodedName.getBytes(UTF_8)); - baos.write("=".getBytes(UTF_8)); - baos.write(encodedValue.getBytes(UTF_8)); - } - - private void addMultiPartFormField(ByteArrayOutputStream baos, String name, String value) throws IOException { - baos.write(twoDashBytes); - baos.write(boundaryBytes); - baos.write(lineFeedBytes); - - String contentDisposition = "Content-Disposition: form-data; name=\"" + name + "\""; - String contentType = "Content-Type: text/plain; charset=utf-8"; - - baos.write(contentDisposition.getBytes(UTF_8)); - baos.write(lineFeedBytes); - baos.write(contentType.getBytes(UTF_8)); - baos.write(lineFeedBytes); - baos.write(lineFeedBytes); - baos.write(value.getBytes(UTF_8)); - baos.write(lineFeedBytes); - } - - private boolean isMultiPart(Map formParams) { - boolean isMultiPart = false; - for (Map.Entry entry : formParams.entrySet()) { - if (entry.getValue() instanceof File) { - isMultiPart = true; - break; - } - } - return isMultiPart; - } - - /** - * Format the given parameter object into string. - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDate((Date) param); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { - if(b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /** - * Format the given Date object into string. - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } -} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ParamExpander.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ParamExpander.mustache new file mode 100644 index 0000000000..2f5095d00f --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ParamExpander.mustache @@ -0,0 +1,22 @@ +package {{invokerPackage}}; + +import feign.Param; + +import java.text.DateFormat; +import java.util.Date; + +/** + * Param Expander to convert {@link Date} to RFC3339 + */ +public class ParamExpander implements Param.Expander { + + private static final DateFormat dateformat = new RFC3339DateFormat(); + + @Override + public String expand(Object value) { + if (value instanceof Date) { + return dateformat.format(value); + } + return value.toString(); + } +} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api.mustache index 6cb2deaccb..a72dac0496 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api.mustache @@ -1,6 +1,9 @@ package {{package}}; import {{invokerPackage}}.ApiClient; +{{#legacyDates}} +import {{invokerPackage}}.ParamExpander; +{{/legacyDates}} {{#imports}}import {{import}}; {{/imports}} @@ -25,12 +28,12 @@ public interface {{classname}} extends ApiClient.Api { */ @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{#hasMore}}&{{/hasMore}}{{/queryParams}}") @Headers({ - "Content-type: {{vendorExtensions.x-contentType}}", + "Content-Type: {{vendorExtensions.x-contentType}}", "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#hasMore}}, {{/hasMore}}{{/headerParams}} }) - {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}@Param("{{paramName}}") {{/isBodyParam}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); {{/operation}} {{/operations}} } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.gradle.mustache index adbe4800eb..0ea9d62f54 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.gradle.mustache @@ -97,6 +97,7 @@ ext { swagger_annotations_version = "1.5.9" jackson_version = "2.7.5" feign_version = "8.17.0" + feign_form_version = "2.0.2" junit_version = "4.12" oltu_version = "1.0.1" } @@ -106,6 +107,7 @@ dependencies { compile "com.netflix.feign:feign-core:$feign_version" compile "com.netflix.feign:feign-jackson:$feign_version" compile "com.netflix.feign:feign-slf4j:$feign_version" + compile "io.github.openfeign.form:feign-form:$feign_form_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache index 98450123af..d0270a99b5 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache @@ -13,6 +13,7 @@ lazy val root = (project in file(".")). "com.netflix.feign" % "feign-core" % "8.16.0" % "compile", "com.netflix.feign" % "feign-jackson" % "8.17.0" % "compile", "com.netflix.feign" % "feign-slf4j" % "8.16.0" % "compile", + "io.github.openfeign.form" % "feign-form" % "2.0.2" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5" % "compile", diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache index 027ae8a9fc..11fc2dea14 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache @@ -125,6 +125,11 @@ feign-slf4j ${feign-version} + + io.github.openfeign.form + feign-form + ${feign-form-version} + @@ -167,6 +172,7 @@ ${java.version} 1.5.9 8.17.0 + 2.0.2 2.7.5 4.12 1.0.0 diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle index 50c4634a73..0e13c2381b 100644 --- a/samples/client/petstore/java/feign/build.gradle +++ b/samples/client/petstore/java/feign/build.gradle @@ -97,6 +97,7 @@ ext { swagger_annotations_version = "1.5.9" jackson_version = "2.7.5" feign_version = "8.17.0" + feign_form_version = "2.0.2" junit_version = "4.12" oltu_version = "1.0.1" } @@ -106,6 +107,7 @@ dependencies { compile "com.netflix.feign:feign-core:$feign_version" compile "com.netflix.feign:feign-jackson:$feign_version" compile "com.netflix.feign:feign-slf4j:$feign_version" + compile "io.github.openfeign.form:feign-form:$feign_form_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" diff --git a/samples/client/petstore/java/feign/build.sbt b/samples/client/petstore/java/feign/build.sbt index 10b1f87592..dd67e3e729 100644 --- a/samples/client/petstore/java/feign/build.sbt +++ b/samples/client/petstore/java/feign/build.sbt @@ -13,6 +13,7 @@ lazy val root = (project in file(".")). "com.netflix.feign" % "feign-core" % "8.16.0" % "compile", "com.netflix.feign" % "feign-jackson" % "8.17.0" % "compile", "com.netflix.feign" % "feign-slf4j" % "8.16.0" % "compile", + "io.github.openfeign.form" % "feign-form" % "2.0.2" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5" % "compile", diff --git a/samples/client/petstore/java/feign/gradlew.bat b/samples/client/petstore/java/feign/gradlew.bat index 72d362dafd..5f192121eb 100644 --- a/samples/client/petstore/java/feign/gradlew.bat +++ b/samples/client/petstore/java/feign/gradlew.bat @@ -1,90 +1,90 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml index 72f588a896..a5675bb249 100644 --- a/samples/client/petstore/java/feign/pom.xml +++ b/samples/client/petstore/java/feign/pom.xml @@ -125,6 +125,11 @@ feign-slf4j ${feign-version} + + io.github.openfeign.form + feign-form + ${feign-form-version} + @@ -167,6 +172,7 @@ ${java.version} 1.5.9 8.17.0 + 2.0.2 2.7.5 4.12 1.0.0 diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java index d4844ec8d0..68480d81e8 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.datatype.joda.JodaModule; import feign.Feign; import feign.RequestInterceptor; +import feign.form.FormEncoder; import feign.jackson.JacksonDecoder; import feign.jackson.JacksonEncoder; import feign.slf4j.Slf4jLogger; @@ -32,7 +33,7 @@ public class ApiClient { objectMapper = createObjectMapper(); apiAuthorizations = new LinkedHashMap(); feignBuilder = Feign.builder() - .encoder(new FormAwareEncoder(new JacksonEncoder(objectMapper))) + .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) .decoder(new JacksonDecoder(objectMapper)) .logger(new Slf4jLogger()); } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java deleted file mode 100644 index 85e7fad4d7..0000000000 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java +++ /dev/null @@ -1,192 +0,0 @@ -package io.swagger.client; - -import java.io.*; -import java.lang.reflect.Type; -import java.net.URLEncoder; -import java.net.URLConnection; -import java.nio.charset.Charset; -import java.util.*; - -import java.text.DateFormat; - -import feign.codec.EncodeException; -import feign.codec.Encoder; -import feign.RequestTemplate; - - -public class FormAwareEncoder implements Encoder { - public static final String UTF_8 = "utf-8"; - private static final String LINE_FEED = "\r\n"; - private static final String TWO_DASH = "--"; - private static final String BOUNDARY = "----------------314159265358979323846"; - - private byte[] lineFeedBytes; - private byte[] boundaryBytes; - private byte[] twoDashBytes; - private byte[] atBytes; - private byte[] eqBytes; - - private final Encoder delegate; - private final DateFormat dateFormat; - - public FormAwareEncoder(Encoder delegate) { - this.delegate = delegate; - this.dateFormat = new RFC3339DateFormat();; - - try { - this.lineFeedBytes = LINE_FEED.getBytes(UTF_8); - this.boundaryBytes = BOUNDARY.getBytes(UTF_8); - this.twoDashBytes = TWO_DASH.getBytes(UTF_8); - this.atBytes = "&".getBytes(UTF_8); - this.eqBytes = "=".getBytes(UTF_8); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - } - - public void encode(Object object, Type bodyType, RequestTemplate template) throws EncodeException { - if (object instanceof Map) { - try { - encodeFormParams(template, (Map) object); - } catch (IOException e) { - throw new EncodeException("Failed to create request", e); - } - } else { - delegate.encode(object, bodyType, template); - } - } - - private void encodeFormParams(RequestTemplate template, Map formParams) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - boolean isMultiPart = isMultiPart(formParams); - boolean isFirstField = true; - for (Map.Entry param : formParams.entrySet()) { - String keyStr = param.getKey(); - if (param.getValue() instanceof File) { - addFilePart(baos, keyStr, (File) param.getValue()); - } else { - String valueStr = parameterToString(param.getValue()); - if (isMultiPart) { - addMultiPartFormField(baos, keyStr, valueStr); - } else { - addEncodedFormField(baos, keyStr, valueStr, isFirstField); - isFirstField = false; - } - } - } - - if (isMultiPart) { - baos.write(lineFeedBytes); - baos.write(twoDashBytes); - baos.write(boundaryBytes); - baos.write(twoDashBytes); - baos.write(lineFeedBytes); - } - - String contentType = isMultiPart ? "multipart/form-data; boundary=" + BOUNDARY : "application/x-www-form-urlencoded"; - template.header("Content-type"); - template.header("Content-type", contentType); - template.header("MIME-Version", "1.0"); - template.body(baos.toByteArray(), Charset.forName(UTF_8)); - } - - /* - * Currently only supports text files - */ - private void addFilePart(ByteArrayOutputStream baos, String fieldName, File uploadFile) throws IOException { - String fileName = uploadFile.getName(); - baos.write(twoDashBytes); - baos.write(boundaryBytes); - baos.write(lineFeedBytes); - - String contentDisposition = "Content-Disposition: form-data; name=\"" + fieldName - + "\"; filename=\"" + fileName + "\""; - baos.write(contentDisposition.getBytes(UTF_8)); - baos.write(lineFeedBytes); - String contentType = "Content-Type: " + URLConnection.guessContentTypeFromName(fileName); - baos.write(contentType.getBytes(UTF_8)); - baos.write(lineFeedBytes); - baos.write(lineFeedBytes); - - BufferedReader reader = new BufferedReader(new FileReader(uploadFile)); - InputStream input = new FileInputStream(uploadFile); - byte[] bytes = new byte[4096]; - int len = bytes.length; - while ((len = input.read(bytes)) != -1) { - baos.write(bytes, 0, len); - baos.write(lineFeedBytes); - } - - baos.write(lineFeedBytes); - } - - private void addEncodedFormField(ByteArrayOutputStream baos, String name, String value, boolean isFirstField) throws IOException { - if (!isFirstField) { - baos.write(atBytes); - } - - String encodedName = URLEncoder.encode(name, UTF_8); - String encodedValue = URLEncoder.encode(value, UTF_8); - baos.write(encodedName.getBytes(UTF_8)); - baos.write("=".getBytes(UTF_8)); - baos.write(encodedValue.getBytes(UTF_8)); - } - - private void addMultiPartFormField(ByteArrayOutputStream baos, String name, String value) throws IOException { - baos.write(twoDashBytes); - baos.write(boundaryBytes); - baos.write(lineFeedBytes); - - String contentDisposition = "Content-Disposition: form-data; name=\"" + name + "\""; - String contentType = "Content-Type: text/plain; charset=utf-8"; - - baos.write(contentDisposition.getBytes(UTF_8)); - baos.write(lineFeedBytes); - baos.write(contentType.getBytes(UTF_8)); - baos.write(lineFeedBytes); - baos.write(lineFeedBytes); - baos.write(value.getBytes(UTF_8)); - baos.write(lineFeedBytes); - } - - private boolean isMultiPart(Map formParams) { - boolean isMultiPart = false; - for (Map.Entry entry : formParams.entrySet()) { - if (entry.getValue() instanceof File) { - isMultiPart = true; - break; - } - } - return isMultiPart; - } - - /** - * Format the given parameter object into string. - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDate((Date) param); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { - if(b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /** - * Format the given Date object into string. - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } -} diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ParamExpander.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ParamExpander.java new file mode 100644 index 0000000000..71a6f5866b --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ParamExpander.java @@ -0,0 +1,22 @@ +package io.swagger.client; + +import feign.Param; + +import java.text.DateFormat; +import java.util.Date; + +/** + * Param Expander to convert {@link Date} to RFC3339 + */ +public class ParamExpander implements Param.Expander { + + private static final DateFormat dateformat = new RFC3339DateFormat(); + + @Override + public String expand(Object value) { + if (value instanceof Date) { + return dateformat.format(value); + } + return value.toString(); + } +} diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/RFC3339DateFormat.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/RFC3339DateFormat.java index 3d287008be..d662f9457d 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/RFC3339DateFormat.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/RFC3339DateFormat.java @@ -1,4 +1,4 @@ -/** +/* * Swagger Petstore * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java index b843c876eb..175d35ef18 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java @@ -25,7 +25,7 @@ public interface FakeApi extends ApiClient.Api { */ @RequestLine("PATCH /fake") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) Client testClientModel(Client body); @@ -46,14 +46,15 @@ public interface FakeApi extends ApiClient.Api { * @param date None (optional) * @param dateTime None (optional) * @param password None (optional) + * @param paramCallback None (optional) * @return void */ @RequestLine("POST /fake") @Headers({ - "Content-type: application/xml; charset=utf-8", + "Content-Type: application/xml; charset=utf-8", "Accept: application/xml; charset=utf-8,application/json; charset=utf-8", }) - void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") byte[] binary, @Param("date") LocalDate date, @Param("dateTime") DateTime dateTime, @Param("password") String password); + void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") byte[] binary, @Param("date") LocalDate date, @Param("dateTime") DateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback); /** * To test enum parameters @@ -70,7 +71,7 @@ public interface FakeApi extends ApiClient.Api { */ @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", "enum_header_string_array: {enumHeaderStringArray}", diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index b6fbdf208d..3c0941a732 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -24,7 +24,7 @@ public interface PetApi extends ApiClient.Api { */ @RequestLine("POST /pet") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) void addPet(Pet body); @@ -38,7 +38,7 @@ public interface PetApi extends ApiClient.Api { */ @RequestLine("DELETE /pet/{petId}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", "api_key: {apiKey}" }) @@ -52,7 +52,7 @@ public interface PetApi extends ApiClient.Api { */ @RequestLine("GET /pet/findByStatus?status={status}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) List findPetsByStatus(@Param("status") List status); @@ -65,7 +65,7 @@ public interface PetApi extends ApiClient.Api { */ @RequestLine("GET /pet/findByTags?tags={tags}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) List findPetsByTags(@Param("tags") List tags); @@ -78,7 +78,7 @@ public interface PetApi extends ApiClient.Api { */ @RequestLine("GET /pet/{petId}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) Pet getPetById(@Param("petId") Long petId); @@ -91,7 +91,7 @@ public interface PetApi extends ApiClient.Api { */ @RequestLine("PUT /pet") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) void updatePet(Pet body); @@ -106,7 +106,7 @@ public interface PetApi extends ApiClient.Api { */ @RequestLine("POST /pet/{petId}") @Headers({ - "Content-type: application/x-www-form-urlencoded", + "Content-Type: application/x-www-form-urlencoded", "Accept: application/json", }) void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); @@ -121,7 +121,7 @@ public interface PetApi extends ApiClient.Api { */ @RequestLine("POST /pet/{petId}/uploadImage") @Headers({ - "Content-type: multipart/form-data", + "Content-Type: multipart/form-data", "Accept: application/json", }) ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java index ee80acba0b..a0d06d34dd 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java @@ -22,7 +22,7 @@ public interface StoreApi extends ApiClient.Api { */ @RequestLine("DELETE /store/order/{orderId}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) void deleteOrder(@Param("orderId") String orderId); @@ -34,7 +34,7 @@ public interface StoreApi extends ApiClient.Api { */ @RequestLine("GET /store/inventory") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) Map getInventory(); @@ -47,7 +47,7 @@ public interface StoreApi extends ApiClient.Api { */ @RequestLine("GET /store/order/{orderId}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) Order getOrderById(@Param("orderId") Long orderId); @@ -60,7 +60,7 @@ public interface StoreApi extends ApiClient.Api { */ @RequestLine("POST /store/order") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) Order placeOrder(Order body); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java index 6a2c8a6afb..d4f59bffc4 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java @@ -22,7 +22,7 @@ public interface UserApi extends ApiClient.Api { */ @RequestLine("POST /user") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) void createUser(User body); @@ -35,7 +35,7 @@ public interface UserApi extends ApiClient.Api { */ @RequestLine("POST /user/createWithArray") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) void createUsersWithArrayInput(List body); @@ -48,7 +48,7 @@ public interface UserApi extends ApiClient.Api { */ @RequestLine("POST /user/createWithList") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) void createUsersWithListInput(List body); @@ -61,7 +61,7 @@ public interface UserApi extends ApiClient.Api { */ @RequestLine("DELETE /user/{username}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) void deleteUser(@Param("username") String username); @@ -74,7 +74,7 @@ public interface UserApi extends ApiClient.Api { */ @RequestLine("GET /user/{username}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) User getUserByName(@Param("username") String username); @@ -88,7 +88,7 @@ public interface UserApi extends ApiClient.Api { */ @RequestLine("GET /user/login?username={username}&password={password}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) String loginUser(@Param("username") String username, @Param("password") String password); @@ -100,7 +100,7 @@ public interface UserApi extends ApiClient.Api { */ @RequestLine("GET /user/logout") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) void logoutUser(); @@ -114,7 +114,7 @@ public interface UserApi extends ApiClient.Api { */ @RequestLine("PUT /user/{username}") @Headers({ - "Content-type: application/json", + "Content-Type: application/json", "Accept: application/json", }) void updateUser(@Param("username") String username, User body); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index 2da13804a0..21e4efaeaa 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -34,12 +34,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - /** * AdditionalPropertiesClass */ -public class AdditionalPropertiesClass { +public class AdditionalPropertiesClass { @JsonProperty("map_property") private Map mapProperty = new HashMap(); @@ -111,6 +110,7 @@ public class AdditionalPropertiesClass { return Objects.hash(mapProperty, mapOfMapProperty); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -132,5 +132,6 @@ public class AdditionalPropertiesClass { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java index 346da224ad..993f9bbe6f 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Animal */ -public class Animal { +public class Animal { @JsonProperty("className") private String className = null; @@ -98,6 +97,7 @@ public class Animal { return Objects.hash(className, color); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -119,5 +119,6 @@ public class Animal { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java index 563476ccb3..181812be4f 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -30,12 +30,11 @@ import io.swagger.client.model.Animal; import java.util.ArrayList; import java.util.List; - /** * AnimalFarm */ -public class AnimalFarm extends ArrayList { +public class AnimalFarm extends ArrayList { @Override public boolean equals(java.lang.Object o) { @@ -53,6 +52,7 @@ public class AnimalFarm extends ArrayList { return Objects.hash(super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -72,5 +72,6 @@ public class AnimalFarm extends ArrayList { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java index a99f200938..c02b8e1a37 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java @@ -34,12 +34,11 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; - /** * ArrayOfArrayOfNumberOnly */ -public class ArrayOfArrayOfNumberOnly { +public class ArrayOfArrayOfNumberOnly { @JsonProperty("ArrayArrayNumber") private List> arrayArrayNumber = new ArrayList>(); @@ -84,6 +83,7 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -104,5 +104,6 @@ public class ArrayOfArrayOfNumberOnly { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java index 1aaf27b992..fe97b65e19 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java @@ -34,12 +34,11 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; - /** * ArrayOfNumberOnly */ -public class ArrayOfNumberOnly { +public class ArrayOfNumberOnly { @JsonProperty("ArrayNumber") private List arrayNumber = new ArrayList(); @@ -84,6 +83,7 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -104,5 +104,6 @@ public class ArrayOfNumberOnly { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java index 124d8bfa3a..a035e8fe2f 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java @@ -34,12 +34,11 @@ import io.swagger.client.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; - /** * ArrayTest */ -public class ArrayTest { +public class ArrayTest { @JsonProperty("array_of_string") private List arrayOfString = new ArrayList(); @@ -138,6 +137,7 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -160,5 +160,6 @@ public class ArrayTest { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java index 41dc312a10..b2532f78f8 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java @@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; - /** * Cat */ -public class Cat extends Animal { +public class Cat extends Animal { @JsonProperty("declawed") private Boolean declawed = null; @@ -78,6 +77,7 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -98,5 +98,6 @@ public class Cat extends Animal { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java index ba4ce89c29..84def6a8da 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Category */ -public class Category { +public class Category { @JsonProperty("id") private Long id = null; @@ -98,6 +97,7 @@ public class Category { return Objects.hash(id, name); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -119,5 +119,6 @@ public class Category { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Client.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Client.java index 43ade4b6fc..1540bc4d7d 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Client.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Client.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Client */ -public class Client { +public class Client { @JsonProperty("client") private String client = null; @@ -76,6 +75,7 @@ public class Client { return Objects.hash(client); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -96,5 +96,6 @@ public class Client { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java index 788aee5c22..d5e9063c98 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java @@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; - /** * Dog */ -public class Dog extends Animal { +public class Dog extends Animal { @JsonProperty("breed") private String breed = null; @@ -78,6 +77,7 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -98,5 +98,6 @@ public class Dog extends Animal { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumArrays.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumArrays.java index 45295c524f..d8be37b302 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumArrays.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumArrays.java @@ -33,12 +33,11 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; - /** * EnumArrays */ -public class EnumArrays { +public class EnumArrays { /** * Gets or Sets justSymbol */ @@ -165,6 +164,7 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -186,5 +186,6 @@ public class EnumArrays { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumClass.java index f9887c6934..c2f4ae5373 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumClass.java @@ -27,7 +27,6 @@ package io.swagger.client.model; import java.util.Objects; - import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java index a7268316c4..cf3cab6645 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * EnumTest */ -public class EnumTest { +public class EnumTest { /** * Gets or Sets enumString */ @@ -210,6 +209,7 @@ public class EnumTest { return Objects.hash(enumString, enumInteger, enumNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -232,5 +232,6 @@ public class EnumTest { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java index 2b5b420428..df839b0898 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java @@ -34,12 +34,11 @@ import java.math.BigDecimal; import org.joda.time.DateTime; import org.joda.time.LocalDate; - /** * FormatTest */ -public class FormatTest { +public class FormatTest { @JsonProperty("integer") private Integer integer = null; @@ -353,6 +352,7 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -385,5 +385,6 @@ public class FormatTest { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java index d874a54524..9f59c6a47b 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * HasOnlyReadOnly */ -public class HasOnlyReadOnly { +public class HasOnlyReadOnly { @JsonProperty("bar") private String bar = null; @@ -80,6 +79,7 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -101,5 +101,6 @@ public class HasOnlyReadOnly { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MapTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MapTest.java index f8cf1ad5d1..335dcb31cb 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MapTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MapTest.java @@ -34,12 +34,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - /** * MapTest */ -public class MapTest { +public class MapTest { @JsonProperty("map_map_of_string") private Map> mapMapOfString = new HashMap>(); @@ -141,6 +140,7 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -162,5 +162,6 @@ public class MapTest { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 20958fd50d..af5292584a 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -36,12 +36,11 @@ import java.util.List; import java.util.Map; import org.joda.time.DateTime; - /** * MixedPropertiesAndAdditionalPropertiesClass */ -public class MixedPropertiesAndAdditionalPropertiesClass { +public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") private String uuid = null; @@ -130,6 +129,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -152,5 +152,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java index 8f48dd8020..e905b7f918 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java @@ -31,13 +31,12 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Model for testing model name starting with number */ @ApiModel(description = "Model for testing model name starting with number") -public class Model200Response { +public class Model200Response { @JsonProperty("name") private Integer name = null; @@ -99,6 +98,7 @@ public class Model200Response { return Objects.hash(name, propertyClass); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -120,5 +120,6 @@ public class Model200Response { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java index 70ee2a834c..f554939b89 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * ModelApiResponse */ -public class ModelApiResponse { +public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -120,6 +119,7 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -142,5 +142,6 @@ public class ModelApiResponse { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java index 28294a1509..5332ff4fe2 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java @@ -31,13 +31,12 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Model for testing reserved words */ @ApiModel(description = "Model for testing reserved words") -public class ModelReturn { +public class ModelReturn { @JsonProperty("return") private Integer _return = null; @@ -77,6 +76,7 @@ public class ModelReturn { return Objects.hash(_return); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -97,5 +97,6 @@ public class ModelReturn { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java index 4b70e8df1a..d26b62921f 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java @@ -31,13 +31,12 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Model for testing model name same as property name */ @ApiModel(description = "Model for testing model name same as property name") -public class Name { +public class Name { @JsonProperty("name") private Integer name = null; @@ -125,6 +124,7 @@ public class Name { return Objects.hash(name, snakeCase, property, _123Number); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -148,5 +148,6 @@ public class Name { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/NumberOnly.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/NumberOnly.java index ad74058d2e..3dc6009047 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/NumberOnly.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/NumberOnly.java @@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; - /** * NumberOnly */ -public class NumberOnly { +public class NumberOnly { @JsonProperty("JustNumber") private BigDecimal justNumber = null; @@ -77,6 +76,7 @@ public class NumberOnly { return Objects.hash(justNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -97,5 +97,6 @@ public class NumberOnly { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java index 1616b030b9..4eea9879c8 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java @@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.joda.time.DateTime; - /** * Order */ -public class Order { +public class Order { @JsonProperty("id") private Long id = null; @@ -219,6 +218,7 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -244,5 +244,6 @@ public class Order { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java index a89e0ea3e0..3ef257006e 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java @@ -35,12 +35,11 @@ import io.swagger.client.model.Tag; import java.util.ArrayList; import java.util.List; - /** * Pet */ -public class Pet { +public class Pet { @JsonProperty("id") private Long id = null; @@ -232,6 +231,7 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -257,5 +257,6 @@ public class Pet { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index 63e11bf14f..0cbe504a29 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * ReadOnlyFirst */ -public class ReadOnlyFirst { +public class ReadOnlyFirst { @JsonProperty("bar") private String bar = null; @@ -89,6 +88,7 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -110,5 +110,6 @@ public class ReadOnlyFirst { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java index f8c5c06ca4..96bbd28594 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * SpecialModelName */ -public class SpecialModelName { +public class SpecialModelName { @JsonProperty("$special[property.name]") private Long specialPropertyName = null; @@ -76,6 +75,7 @@ public class SpecialModelName { return Objects.hash(specialPropertyName); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -96,5 +96,6 @@ public class SpecialModelName { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java index 27be94678d..330d2c8faa 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Tag */ -public class Tag { +public class Tag { @JsonProperty("id") private Long id = null; @@ -98,6 +97,7 @@ public class Tag { return Objects.hash(id, name); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -119,5 +119,6 @@ public class Tag { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java index 84e3b14704..97fc77b476 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * User */ -public class User { +public class User { @JsonProperty("id") private Long id = null; @@ -230,6 +229,7 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -257,5 +257,6 @@ public class User { } return o.toString().replace("\n", "\n "); } + } From f25f6c265a88aaf7ea32ba64e516904b9b7d788e Mon Sep 17 00:00:00 2001 From: Stephan Wienczny Date: Fri, 4 Nov 2016 14:59:04 +0100 Subject: [PATCH 05/16] Update pojo.mustache Repair vendorExtensions due to broken merge. --- .../swagger-codegen/src/main/resources/Java/pojo.mustache | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache index 4e706ed7d4..408c6dbe64 100644 --- a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache @@ -63,12 +63,9 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela {{/maximum}} * @return {{name}} **/ - {{#vendorExtensions.extraAnnotation}} - {{{vendorExtensions.extraAnnotation}}} - {{/vendorExtensions.extraAnnotation}} {{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") {{#vendorExtensions.extraAnnotation}} - {{vendorExtensions.extraAnnotation}} + {{{vendorExtensions.extraAnnotation}}} {{/vendorExtensions.extraAnnotation}} public {{{datatypeWithEnum}}} {{getter}}() { return {{name}}; From 9436ba106c97ab9fb38fcec2aa551e388cbe9a75 Mon Sep 17 00:00:00 2001 From: Stephan Wienczny Date: Fri, 4 Nov 2016 15:35:48 +0100 Subject: [PATCH 06/16] Default added sourceFolder to src/main/java Fallback to "src/main/java" for added source folder instead of a NullpointerException when no source folder ist configured in the pom --- .../src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java b/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java index aca8bbf673..1755e67750 100644 --- a/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java +++ b/modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java @@ -310,7 +310,10 @@ public class CodeGenMojo extends AbstractMojo { } if (addCompileSourceRoot) { - String sourceJavaFolder = output.toString() + "/" + configOptions.get(CodegenConstants.SOURCE_FOLDER); + final Object sourceFolderObject = configOptions.get(CodegenConstants.SOURCE_FOLDER); + final String sourceFolder = sourceFolderObject == null ? "src/main/java" : sourceFolderObject.toString(); + + String sourceJavaFolder = output.toString() + "/" + sourceFolder; project.addCompileSourceRoot(sourceJavaFolder); } } From a624729d70365ba735c3388268f3d2705f51203a Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Fri, 4 Nov 2016 15:16:04 -0700 Subject: [PATCH 07/16] added clarification for #4138 --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 7253eea064..6960980589 100644 --- a/README.md +++ b/README.md @@ -913,6 +913,15 @@ Here are the requirements to become a core team member: To become a Template Creator, simply submit a PR for new API client (e.g. Rust, Elixir) or server stub (e.g. Ruby Grape) generator. +## License information on Generated Code + +The Swagger Codegen project is intended as a benefit for users of the Swagger / Open API Specification. The project itself has the [License](#license) as specified. In addition, please understand the following points: + +* The templates included with this project are subject to the [License](#license). +* Generated code is intentionally _not_ subject to the parent project license + +When code is generated from this project, it shall be considered **AS IS** and owned by the user of the software. There are no warranties--expressed or implied--for generated code. You can do what you wish with it, and once generated, the code is your responsibility and subject to the licensing terms that you deem appropriate. + License ------- From 2f1f62e384b71e82a3d20a0d1e7b57f88de93cb6 Mon Sep 17 00:00:00 2001 From: Oleg Polosin Date: Sat, 5 Nov 2016 12:11:58 +0000 Subject: [PATCH 08/16] Added QAdept to companies list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6960980589..26c247a2ec 100644 --- a/README.md +++ b/README.md @@ -792,6 +792,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [Plexxi](http://www.plexxi.com) - [Pixoneye](http://www.pixoneye.com/) - [PostAffiliatePro](https://www.postaffiliatepro.com/) +- [QAdept](http://qadept.com/) - [QuantiModo](https://quantimo.do/) - [Rapid7](https://rapid7.com/) - [Reload! A/S](https://reload.dk/) From 1a2b345c57bdb93bdcc5fbbb76eac34854f1720e Mon Sep 17 00:00:00 2001 From: Roman Truba Date: Sat, 5 Nov 2016 18:13:51 +0300 Subject: [PATCH 09/16] [Obj-c] Generated code documentation fixes (#4130) * Fixed missing parameters names for obj-c generated code * Obj-c sample regenerated --- .../src/main/resources/objc/ApiClient-header.mustache | 2 +- .../src/main/resources/objc/Configuration-header.mustache | 6 +++--- .../resources/objc/ResponseDeserializer-header.mustache | 2 +- .../petstore/objc/default/SwaggerClient/Core/SWGApiClient.h | 2 +- .../objc/default/SwaggerClient/Core/SWGConfiguration.h | 6 +++--- .../default/SwaggerClient/Core/SWGResponseDeserializer.h | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache index 74ffd6f78c..0167cd52ec 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache @@ -72,7 +72,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey; /** * Sets the client reachability, this may be overridden by the reachability manager if reachability changes * - * @param The client reachability. + * @param status The client reachability status. */ +(void) setReachabilityStatus:(AFNetworkReachabilityStatus) status; diff --git a/modules/swagger-codegen/src/main/resources/objc/Configuration-header.mustache b/modules/swagger-codegen/src/main/resources/objc/Configuration-header.mustache index e727942a4f..13747889d6 100644 --- a/modules/swagger-codegen/src/main/resources/objc/Configuration-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/Configuration-header.mustache @@ -100,7 +100,7 @@ /** * Sets the prefix for API key * - * @param apiKeyPrefix API key prefix. + * @param prefix API key prefix. * @param identifier API key identifier. */ - (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier; @@ -140,7 +140,7 @@ /** * Removes header from defaultHeaders * -* @param Header name. +* @param key Header name. */ -(void) removeDefaultHeaderForKey:(NSString*)key; @@ -153,7 +153,7 @@ -(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key; /** -* @param Header key name. +* @param key Header key name. */ -(NSString*) defaultHeaderForKey:(NSString*)key; diff --git a/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache index 90aa174d7c..774fe1ee5a 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ResponseDeserializer-header.mustache @@ -28,7 +28,7 @@ extern NSInteger const {{classPrefix}}UnknownResponseObjectErrorCode; * Deserializes the given data to Objective-C object. * * @param data The data will be deserialized. - * @param class The type of objective-c object. + * @param className The type of objective-c object. * @param error The error */ - (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error; diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h index a5f267821d..514dd78a10 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h @@ -98,7 +98,7 @@ extern NSString *const SWGResponseObjectErrorKey; /** * Sets the client reachability, this may be overridden by the reachability manager if reachability changes * - * @param The client reachability. + * @param status The client reachability status. */ +(void) setReachabilityStatus:(AFNetworkReachabilityStatus) status; diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.h index b6c37405ca..5a9aec46be 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.h +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.h @@ -122,7 +122,7 @@ /** * Sets the prefix for API key * - * @param apiKeyPrefix API key prefix. + * @param prefix API key prefix. * @param identifier API key identifier. */ - (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier; @@ -162,7 +162,7 @@ /** * Removes header from defaultHeaders * -* @param Header name. +* @param key Header name. */ -(void) removeDefaultHeaderForKey:(NSString*)key; @@ -175,7 +175,7 @@ -(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key; /** -* @param Header key name. +* @param key Header key name. */ -(NSString*) defaultHeaderForKey:(NSString*)key; diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.h index c0d7b716a0..ae1c2b18b9 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.h +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.h @@ -50,7 +50,7 @@ extern NSInteger const SWGUnknownResponseObjectErrorCode; * Deserializes the given data to Objective-C object. * * @param data The data will be deserialized. - * @param class The type of objective-c object. + * @param className The type of objective-c object. * @param error The error */ - (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error; From ab9ea5b2c380498745fc1e5520396987b526a937 Mon Sep 17 00:00:00 2001 From: keysolutions Date: Sat, 5 Nov 2016 11:14:48 -0400 Subject: [PATCH 10/16] Add constructFromObject to Javascript enum generation. (#4120) * Add constructFromObject to Javascript enum generation. Generated code calls constructFromObject on enum types, but enum did not define the necessary function. Returns the value of the enum. * Update Petstore JS API client --- .../Javascript/partial_model_enum_class.mustache | 9 +++++++++ .../petstore/javascript-promise/src/model/EnumClass.js | 9 +++++++++ .../client/petstore/javascript/src/model/EnumClass.js | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache index 9ad7e3d3a9..39d3463991 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/partial_model_enum_class.mustache @@ -20,5 +20,14 @@ {{/allowableValues}} }; + /** + * Returns a {{classname}} enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {{=< >=}}{module:<#invokerPackage>/<#modelPackage>/}<={{ }}=> The enum {{classname}} value. + */ + exports.constructFromObject = function(object) { + return exports[object]; + } + return exports; })); diff --git a/samples/client/petstore/javascript-promise/src/model/EnumClass.js b/samples/client/petstore/javascript-promise/src/model/EnumClass.js index 941acefddb..9b9884b5f4 100644 --- a/samples/client/petstore/javascript-promise/src/model/EnumClass.js +++ b/samples/client/petstore/javascript-promise/src/model/EnumClass.js @@ -62,6 +62,15 @@ */ "(xyz)": "(xyz)" }; + /** + * Returns a EnumClass enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {module:model/EnumClass} The enum EnumClass value. + */ + exports.constructFromObject = function(object) { + return exports[object]; + } + return exports; })); diff --git a/samples/client/petstore/javascript/src/model/EnumClass.js b/samples/client/petstore/javascript/src/model/EnumClass.js index 941acefddb..9b9884b5f4 100644 --- a/samples/client/petstore/javascript/src/model/EnumClass.js +++ b/samples/client/petstore/javascript/src/model/EnumClass.js @@ -62,6 +62,15 @@ */ "(xyz)": "(xyz)" }; + /** + * Returns a EnumClass enum value from a Javascript object name. + * @param {Object} data The plain JavaScript object containing the name of the enum value. + * @return {module:model/EnumClass} The enum EnumClass value. + */ + exports.constructFromObject = function(object) { + return exports[object]; + } + return exports; })); From ad1765475d90a47edeedaf17872944f5d00b2ecf Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Mon, 7 Nov 2016 03:12:59 -0500 Subject: [PATCH 11/16] [aspnet5] Fix broken template directory for deprecated lang (#4142) --- .../java/io/swagger/codegen/languages/AspNet5ServerCodegen.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java index d22e18f2cd..83bbfbb6ad 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java @@ -10,6 +10,8 @@ public class AspNet5ServerCodegen extends AspNetCoreServerCodegen { public AspNet5ServerCodegen() { super(); + + embeddedTemplateDir = templateDir = "aspnetcore"; } @Override From a1cd01916eb6dcfe5610860c0b21d8c5899a134b Mon Sep 17 00:00:00 2001 From: Roman Truba Date: Mon, 7 Nov 2016 18:47:09 +0300 Subject: [PATCH 12/16] [ObjC] Fix deprecated JSONModel API usage (#4133) * Fixed deprecated usage -[JSONKeyMapper initWithDictionary:] * Petstore regenerated * Change minimal required version of JSONModel --- .../swagger-codegen/src/main/resources/objc/model-body.mustache | 2 +- .../swagger-codegen/src/main/resources/objc/podspec.mustache | 2 +- .../petstore/objc/default/SwaggerClient/Model/SWGCategory.m | 2 +- .../client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m | 2 +- .../client/petstore/objc/default/SwaggerClient/Model/SWGPet.m | 2 +- .../client/petstore/objc/default/SwaggerClient/Model/SWGTag.m | 2 +- .../client/petstore/objc/default/SwaggerClient/Model/SWGUser.m | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/objc/model-body.mustache b/modules/swagger-codegen/src/main/resources/objc/model-body.mustache index 5ca9303e5a..8307a28d54 100644 --- a/modules/swagger-codegen/src/main/resources/objc/model-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/model-body.mustache @@ -43,7 +43,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ {{#vars}}@"{{baseName}}": @"{{name}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ {{#vars}}@"{{name}}": @"{{baseName}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }]; } /** diff --git a/modules/swagger-codegen/src/main/resources/objc/podspec.mustache b/modules/swagger-codegen/src/main/resources/objc/podspec.mustache index bd0bd9f328..ecacd4aa0a 100644 --- a/modules/swagger-codegen/src/main/resources/objc/podspec.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/podspec.mustache @@ -31,7 +31,7 @@ Pod::Spec.new do |s| {{#useCoreData}} s.resources = '{{podName}}/**/*.{xcdatamodeld,xcdatamodel}'{{/useCoreData}} s.dependency 'AFNetworking', '~> 3' - s.dependency 'JSONModel', '~> 1.2' + s.dependency 'JSONModel', '~> 1.4' s.dependency 'ISO8601', '~> 0.5' end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m index 00745d1f49..21e354b30e 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m @@ -17,7 +17,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }]; } /** diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m index e0b44e0695..7f93b0212c 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m @@ -17,7 +17,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }]; } /** diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m index a1c63520dc..8c958695c8 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m @@ -17,7 +17,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }]; } /** diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m index e71829873d..3a62bcbb9a 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m @@ -17,7 +17,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }]; } /** diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m index c8195660df..fd50c02e2c 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m @@ -17,7 +17,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }]; } /** From 46c4eb3869adcf0c6b64570a90e797b753c4d015 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 7 Nov 2016 23:54:47 +0800 Subject: [PATCH 13/16] update mxf4j sample --- samples/server/petstore/java-msf4j/pom.xml | 10 ------ .../src/gen/java/io/swagger/api/FakeApi.java | 4 +-- .../java/io/swagger/api/FakeApiService.java | 32 ++++++++++++++++--- .../src/gen/java/io/swagger/api/PetApi.java | 6 ++-- .../java/io/swagger/api/PetApiService.java | 32 +++++++++++++------ .../src/gen/java/io/swagger/api/StoreApi.java | 4 +-- .../java/io/swagger/api/StoreApiService.java | 12 ++++--- .../src/gen/java/io/swagger/api/UserApi.java | 4 +-- .../java/io/swagger/api/UserApiService.java | 26 ++++++++++----- .../swagger/api/impl/FakeApiServiceImpl.java | 32 ++++++++++++++++--- .../swagger/api/impl/PetApiServiceImpl.java | 32 +++++++++++++------ .../swagger/api/impl/StoreApiServiceImpl.java | 12 ++++--- .../swagger/api/impl/UserApiServiceImpl.java | 26 ++++++++++----- 13 files changed, 163 insertions(+), 69 deletions(-) diff --git a/samples/server/petstore/java-msf4j/pom.xml b/samples/server/petstore/java-msf4j/pom.xml index b408c98d9e..b7c61004ba 100644 --- a/samples/server/petstore/java-msf4j/pom.xml +++ b/samples/server/petstore/java-msf4j/pom.xml @@ -66,16 +66,6 @@ jackson-datatype-joda 2.4.1 - - org.glassfish.jersey.containers - jersey-container-servlet-core - ${jersey2-version} - - - org.glassfish.jersey.media - jersey-media-multipart - ${jersey2-version} - diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java index ca3257cd21..1ff18daec2 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java @@ -16,8 +16,8 @@ import io.swagger.api.NotFoundException; import java.io.InputStream; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.FormDataParam; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java index ae97d88b73..33a0ff02d3 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java @@ -3,7 +3,8 @@ package io.swagger.api; import io.swagger.api.*; import io.swagger.model.*; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import io.swagger.model.Client; import java.util.Date; @@ -19,7 +20,30 @@ import javax.ws.rs.core.SecurityContext; public abstract class FakeApiService { - public abstract Response testClientModel(Client body ) throws NotFoundException; - public abstract Response testEndpointParameters(BigDecimal number ,Double _double ,String patternWithoutDelimiter ,byte[] _byte ,Integer integer ,Integer int32 ,Long int64 ,Float _float ,String string ,byte[] binary ,Date date ,Date dateTime ,String password ,String paramCallback ) throws NotFoundException; - public abstract Response testEnumParameters(List enumFormStringArray ,String enumFormString ,List enumHeaderStringArray ,String enumHeaderString ,List enumQueryStringArray ,String enumQueryString ,BigDecimal enumQueryInteger ,Double enumQueryDouble ) throws NotFoundException; + public abstract Response testClientModel(Client body + ) throws NotFoundException; + public abstract Response testEndpointParameters(BigDecimal number + ,Double _double + ,String patternWithoutDelimiter + ,byte[] _byte + ,Integer integer + ,Integer int32 + ,Long int64 + ,Float _float + ,String string + ,byte[] binary + ,Date date + ,Date dateTime + ,String password + ,String paramCallback + ) throws NotFoundException; + public abstract Response testEnumParameters(List enumFormStringArray + ,String enumFormString + ,List enumHeaderStringArray + ,String enumHeaderString + ,List enumQueryStringArray + ,String enumQueryString + ,BigDecimal enumQueryInteger + ,Double enumQueryDouble + ) throws NotFoundException; } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java index 641fcd6bd2..a6b77ddc77 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java @@ -16,8 +16,8 @@ import io.swagger.api.NotFoundException; import java.io.InputStream; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.FormDataParam; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; @@ -179,7 +179,7 @@ public class PetApi { ,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata , @FormDataParam("file") InputStream fileInputStream, - @FormDataParam("file") FormDataContentDisposition fileDetail + @FormDataParam("file") FileInfo fileDetail ) throws NotFoundException { return delegate.uploadFile(petId,additionalMetadata,fileInputStream, fileDetail); diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java index cc55195c9d..f96a130585 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java @@ -3,7 +3,8 @@ package io.swagger.api; import io.swagger.api.*; import io.swagger.model.*; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import io.swagger.model.Pet; import java.io.File; @@ -19,12 +20,25 @@ import javax.ws.rs.core.SecurityContext; public abstract class PetApiService { - public abstract Response addPet(Pet body ) throws NotFoundException; - public abstract Response deletePet(Long petId ,String apiKey ) throws NotFoundException; - public abstract Response findPetsByStatus(List status ) throws NotFoundException; - public abstract Response findPetsByTags(List tags ) throws NotFoundException; - public abstract Response getPetById(Long petId ) throws NotFoundException; - public abstract Response updatePet(Pet body ) throws NotFoundException; - public abstract Response updatePetWithForm(Long petId ,String name ,String status ) throws NotFoundException; - public abstract Response uploadFile(Long petId ,String additionalMetadata ,InputStream fileInputStream, FormDataContentDisposition fileDetail ) throws NotFoundException; + public abstract Response addPet(Pet body + ) throws NotFoundException; + public abstract Response deletePet(Long petId + ,String apiKey + ) throws NotFoundException; + public abstract Response findPetsByStatus(List status + ) throws NotFoundException; + public abstract Response findPetsByTags(List tags + ) throws NotFoundException; + public abstract Response getPetById(Long petId + ) throws NotFoundException; + public abstract Response updatePet(Pet body + ) throws NotFoundException; + public abstract Response updatePetWithForm(Long petId + ,String name + ,String status + ) throws NotFoundException; + public abstract Response uploadFile(Long petId + ,String additionalMetadata + ,InputStream fileInputStream, FileInfo fileDetail + ) throws NotFoundException; } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApi.java index 4bd3369fb9..6d6aa3848f 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApi.java @@ -15,8 +15,8 @@ import io.swagger.api.NotFoundException; import java.io.InputStream; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.FormDataParam; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApiService.java index 40d6e37102..58331f65bf 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApiService.java @@ -3,7 +3,8 @@ package io.swagger.api; import io.swagger.api.*; import io.swagger.model.*; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import java.util.Map; import io.swagger.model.Order; @@ -18,8 +19,11 @@ import javax.ws.rs.core.SecurityContext; public abstract class StoreApiService { - public abstract Response deleteOrder(String orderId ) throws NotFoundException; + public abstract Response deleteOrder(String orderId + ) throws NotFoundException; public abstract Response getInventory() throws NotFoundException; - public abstract Response getOrderById(Long orderId ) throws NotFoundException; - public abstract Response placeOrder(Order body ) throws NotFoundException; + public abstract Response getOrderById(Long orderId + ) throws NotFoundException; + public abstract Response placeOrder(Order body + ) throws NotFoundException; } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java index 6db93811a6..fe7159324b 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java @@ -15,8 +15,8 @@ import io.swagger.api.NotFoundException; import java.io.InputStream; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.FormDataParam; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java index 2d41ae3a61..5042a55134 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java @@ -3,7 +3,8 @@ package io.swagger.api; import io.swagger.api.*; import io.swagger.model.*; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import io.swagger.model.User; import java.util.List; @@ -18,12 +19,21 @@ import javax.ws.rs.core.SecurityContext; public abstract class UserApiService { - public abstract Response createUser(User body ) throws NotFoundException; - public abstract Response createUsersWithArrayInput(List body ) throws NotFoundException; - public abstract Response createUsersWithListInput(List body ) throws NotFoundException; - public abstract Response deleteUser(String username ) throws NotFoundException; - public abstract Response getUserByName(String username ) throws NotFoundException; - public abstract Response loginUser(String username ,String password ) throws NotFoundException; + public abstract Response createUser(User body + ) throws NotFoundException; + public abstract Response createUsersWithArrayInput(List body + ) throws NotFoundException; + public abstract Response createUsersWithListInput(List body + ) throws NotFoundException; + public abstract Response deleteUser(String username + ) throws NotFoundException; + public abstract Response getUserByName(String username + ) throws NotFoundException; + public abstract Response loginUser(String username + ,String password + ) throws NotFoundException; public abstract Response logoutUser() throws NotFoundException; - public abstract Response updateUser(String username ,User body ) throws NotFoundException; + public abstract Response updateUser(String username + ,User body + ) throws NotFoundException; } diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java index f4fb686549..43e07c1446 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java @@ -12,7 +12,8 @@ import io.swagger.api.NotFoundException; import java.io.InputStream; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; @@ -20,17 +21,40 @@ import javax.ws.rs.core.SecurityContext; public class FakeApiServiceImpl extends FakeApiService { @Override - public Response testClientModel(Client body ) throws NotFoundException { + public Response testClientModel(Client body + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, Date date, Date dateTime, String password, String paramCallback ) throws NotFoundException { + public Response testEndpointParameters(BigDecimal number +, Double _double +, String patternWithoutDelimiter +, byte[] _byte +, Integer integer +, Integer int32 +, Long int64 +, Float _float +, String string +, byte[] binary +, Date date +, Date dateTime +, String password +, String paramCallback + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response testEnumParameters(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble ) throws NotFoundException { + public Response testEnumParameters(List enumFormStringArray +, String enumFormString +, List enumHeaderStringArray +, String enumHeaderString +, List enumQueryStringArray +, String enumQueryString +, BigDecimal enumQueryInteger +, Double enumQueryDouble + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java index e99c9fa1e7..ea6b7553a5 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java @@ -12,7 +12,8 @@ import io.swagger.api.NotFoundException; import java.io.InputStream; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; @@ -20,42 +21,55 @@ import javax.ws.rs.core.SecurityContext; public class PetApiServiceImpl extends PetApiService { @Override - public Response addPet(Pet body ) throws NotFoundException { + public Response addPet(Pet body + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response deletePet(Long petId, String apiKey ) throws NotFoundException { + public Response deletePet(Long petId +, String apiKey + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response findPetsByStatus(List status ) throws NotFoundException { + public Response findPetsByStatus(List status + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response findPetsByTags(List tags ) throws NotFoundException { + public Response findPetsByTags(List tags + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response getPetById(Long petId ) throws NotFoundException { + public Response getPetById(Long petId + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response updatePet(Pet body ) throws NotFoundException { + public Response updatePet(Pet body + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response updatePetWithForm(Long petId, String name, String status ) throws NotFoundException { + public Response updatePetWithForm(Long petId +, String name +, String status + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response uploadFile(Long petId, String additionalMetadata, InputStream fileInputStream, FormDataContentDisposition fileDetail ) throws NotFoundException { + public Response uploadFile(Long petId +, String additionalMetadata +, InputStream fileInputStream, FileInfo fileDetail + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java index 9df17bebc1..cc9af6a759 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java @@ -11,7 +11,8 @@ import io.swagger.api.NotFoundException; import java.io.InputStream; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; @@ -19,7 +20,8 @@ import javax.ws.rs.core.SecurityContext; public class StoreApiServiceImpl extends StoreApiService { @Override - public Response deleteOrder(String orderId ) throws NotFoundException { + public Response deleteOrder(String orderId + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @@ -29,12 +31,14 @@ public class StoreApiServiceImpl extends StoreApiService { return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response getOrderById(Long orderId ) throws NotFoundException { + public Response getOrderById(Long orderId + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response placeOrder(Order body ) throws NotFoundException { + public Response placeOrder(Order body + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java index bab444ea62..babd595dca 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java @@ -11,7 +11,8 @@ import io.swagger.api.NotFoundException; import java.io.InputStream; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; @@ -19,32 +20,39 @@ import javax.ws.rs.core.SecurityContext; public class UserApiServiceImpl extends UserApiService { @Override - public Response createUser(User body ) throws NotFoundException { + public Response createUser(User body + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response createUsersWithArrayInput(List body ) throws NotFoundException { + public Response createUsersWithArrayInput(List body + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response createUsersWithListInput(List body ) throws NotFoundException { + public Response createUsersWithListInput(List body + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response deleteUser(String username ) throws NotFoundException { + public Response deleteUser(String username + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response getUserByName(String username ) throws NotFoundException { + public Response getUserByName(String username + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response loginUser(String username, String password ) throws NotFoundException { + public Response loginUser(String username +, String password + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @@ -54,7 +62,9 @@ public class UserApiServiceImpl extends UserApiService { return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response updateUser(String username, User body ) throws NotFoundException { + public Response updateUser(String username +, User body + ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } From 37460ee833fd31a1f363037aa7a3950ade104307 Mon Sep 17 00:00:00 2001 From: mbohlool Date: Mon, 7 Nov 2016 11:48:30 -0800 Subject: [PATCH 14/16] Select application/json content-type in python generated client, if */* is in the list of content-types --- .../src/main/resources/python/api_client.mustache | 2 +- samples/client/petstore/python/petstore_api/api_client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index 0a5864a81a..dc4fe509f6 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -462,7 +462,7 @@ class ApiClient(object): content_types = list(map(lambda x: x.lower(), content_types)) - if 'application/json' in content_types: + if 'application/json' in content_types or '*/*' in content_types: return 'application/json' else: return content_types[0] diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index adf66173db..bd57c1089a 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -462,7 +462,7 @@ class ApiClient(object): content_types = list(map(lambda x: x.lower(), content_types)) - if 'application/json' in content_types: + if 'application/json' in content_types or '*/*' in content_types: return 'application/json' else: return content_types[0] From 935bdfe6280eea9f32a30d76bee2801b763c3ac9 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 8 Nov 2016 16:17:51 +0800 Subject: [PATCH 15/16] better handling of */* --- .../main/java/io/swagger/codegen/DefaultCodegen.java | 12 ++++++++++-- .../src/main/resources/ruby/api_client.mustache | 3 ++- ...store-with-fake-endpoints-models-for-testing.yaml | 4 ++-- samples/client/petstore/ruby/docs/FakeApi.md | 4 ++-- .../petstore/ruby/lib/petstore/api/fake_api.rb | 4 ++-- .../client/petstore/ruby/lib/petstore/api_client.rb | 3 ++- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 23bfb825be..63cad401d0 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -1892,7 +1892,11 @@ public class DefaultCodegen { for (String key : consumes) { Map mediaType = new HashMap(); // 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 mediaType = new HashMap(); // 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"); diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache index fcd4b3eebf..7fa611e374 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache @@ -125,10 +125,11 @@ module {{moduleName}} # application/json # application/json; charset=UTF8 # APPLICATION/JSON + # */* # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil? + (mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil? end # Deserialize the response to the given return type. diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index c42dc774a2..4666a0cc16 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -590,9 +590,9 @@ paths: descriptions: To test enum parameters operationId: testEnumParameters consumes: - - application/json + - "*/*" produces: - - application/json + - "*/*" parameters: - name: enum_form_string_array type: array diff --git a/samples/client/petstore/ruby/docs/FakeApi.md b/samples/client/petstore/ruby/docs/FakeApi.md index 1524d9c915..971fdadb1a 100644 --- a/samples/client/petstore/ruby/docs/FakeApi.md +++ b/samples/client/petstore/ruby/docs/FakeApi.md @@ -191,8 +191,8 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json + - **Content-Type**: */* + - **Accept**: */* diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index 3500dfbb52..a9c7cf0771 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -306,11 +306,11 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json'] + local_header_accept = ['*/*'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' - local_header_content_type = ['application/json'] + local_header_content_type = ['*/*'] header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil? header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil? diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index 0a95711ce4..64cc2e286c 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -142,10 +142,11 @@ module Petstore # application/json # application/json; charset=UTF8 # APPLICATION/JSON + # */* # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil? + (mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil? end # Deserialize the response to the given return type. From cce410c4634f54aee9ed6605c87ce5bdfa412fb9 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 8 Nov 2016 21:06:38 +0800 Subject: [PATCH 16/16] add vendor extension to handle void response in jaxrs-cxf --- .../AbstractJavaJAXRSServerCodegen.java | 3 + .../JavaJaxRS/cxf/apiServiceImpl.mustache | 2 +- pom.xml | 12 + samples/server/petstore/jaxrs-cxf/pom.xml | 222 ++++++------------ samples/server/petstore/jaxrs/jersey2/pom.xml | 8 + .../src/gen/java/io/swagger/api/FakeApi.java | 4 +- .../model/AdditionalPropertiesClass.java | 26 ++ .../src/gen/java/io/swagger/model/Animal.java | 26 ++ .../gen/java/io/swagger/model/AnimalFarm.java | 26 ++ .../model/ArrayOfArrayOfNumberOnly.java | 26 ++ .../io/swagger/model/ArrayOfNumberOnly.java | 26 ++ .../gen/java/io/swagger/model/ArrayTest.java | 26 ++ .../src/gen/java/io/swagger/model/Cat.java | 26 ++ .../gen/java/io/swagger/model/Category.java | 26 ++ .../src/gen/java/io/swagger/model/Client.java | 26 ++ .../src/gen/java/io/swagger/model/Dog.java | 26 ++ .../gen/java/io/swagger/model/EnumArrays.java | 26 ++ .../gen/java/io/swagger/model/EnumClass.java | 26 +- .../gen/java/io/swagger/model/EnumTest.java | 26 ++ .../gen/java/io/swagger/model/FormatTest.java | 26 ++ .../io/swagger/model/HasOnlyReadOnly.java | 26 ++ .../gen/java/io/swagger/model/MapTest.java | 26 ++ ...ropertiesAndAdditionalPropertiesClass.java | 26 ++ .../io/swagger/model/Model200Response.java | 26 ++ .../io/swagger/model/ModelApiResponse.java | 26 ++ .../java/io/swagger/model/ModelReturn.java | 26 ++ .../src/gen/java/io/swagger/model/Name.java | 26 ++ .../gen/java/io/swagger/model/NumberOnly.java | 26 ++ .../src/gen/java/io/swagger/model/Order.java | 26 ++ .../src/gen/java/io/swagger/model/Pet.java | 26 ++ .../java/io/swagger/model/ReadOnlyFirst.java | 26 ++ .../io/swagger/model/SpecialModelName.java | 26 ++ .../src/gen/java/io/swagger/model/Tag.java | 26 ++ .../src/gen/java/io/swagger/model/User.java | 26 ++ 34 files changed, 820 insertions(+), 159 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java index de0812c40f..af961e9983 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java @@ -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(">"); diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache index 9b55d4c755..c0199a9b5c 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache @@ -25,7 +25,7 @@ public class {{classname}}ServiceImpl implements {{classname}} { public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { // TODO: Implement... - {{#returnType}}return null;{{/returnType}} + {{^vendorExtensions.x-java-is-response-void}}return null;{{/vendorExtensions.x-java-is-response-void}} } {{/operation}} diff --git a/pom.xml b/pom.xml index 1418373025..562011ff71 100644 --- a/pom.xml +++ b/pom.xml @@ -463,6 +463,18 @@ samples/server/petstore/java-msf4/ + + jaxrs-cxf-server + + + env + java + + + + samples/server/petstore/jaxrs-cxf + + jaxrs-resteasy-server diff --git a/samples/server/petstore/jaxrs-cxf/pom.xml b/samples/server/petstore/jaxrs-cxf/pom.xml index 6b0b231802..24ae04f9d1 100644 --- a/samples/server/petstore/jaxrs-cxf/pom.xml +++ b/samples/server/petstore/jaxrs-cxf/pom.xml @@ -1,18 +1,13 @@ 4.0.0 io.swagger - swagger-jaxrs-cxf-server - jar - swagger-jaxrs-cxf-server + swagger-cxf-server + war + swagger-cxf-server 1.0.0 - gen/main/java + src/main/java - - org.apache.maven.plugins - maven-war-plugin - 2.1.1 - maven-failsafe-plugin 2.6 @@ -25,7 +20,7 @@ - + org.codehaus.mojo build-helper-maven-plugin @@ -76,143 +70,87 @@ - gen/java + src/gen/java + + + + maven-war-plugin + 2.1.1 + + true + + - - - org.springframework - spring-context - ${springframework-version} + io.swagger + swagger-jaxrs + compile + ${swagger-core-version} - - org.springframework - spring-context-support - ${springframework-version} - - - org.springframework - spring-web - ${springframework-version} - - - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${cxf-version} - - - - org.apache.cxf - cxf-rt-transports-http - ${cxf-version} - - - - org.apache.cxf - cxf-rt-rs-extension-providers - ${cxf-version} - - - - javax.ws.rs - jsr311-api - 1.1.1 - - - - - org.slf4j - slf4j-api - ${slf4j-version} - - - - - org.slf4j - log4j-over-slf4j - ${slf4j-version} - runtime - - - - org.slf4j - jcl-over-slf4j - ${slf4j-version} - - - - org.slf4j - jul-to-slf4j - ${slf4j-version} - - ch.qos.logback logback-classic - 1.0.9 - runtime - - - - - - - - javax.servlet - servlet-api - ${servlet-api-version} - provided - - - org.scala-lang - scala-library - ${scala-version} + ch.qos.logback + logback-core + ${logback-version} + compile - - - org.springframework - spring-test - ${springframework-version} - test - - - - org.apache.cxf - cxf-rt-transports-http-jetty - ${cxf-version} - test - - - - org.scalatest - scalatest_2.10 - ${scala-test-version} - test - - junit junit ${junit-version} test - + + + org.apache.cxf + cxf-rt-rs-client + ${cxf-version} + test + + + + + org.apache.cxf + cxf-rt-frontend-jaxrs + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-rs-service-description + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-rs-service-description-swagger + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-ws-policy + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-wsdl + ${cxf-version} + compile + @@ -229,37 +167,11 @@ ${java.version} 1.5.9 9.2.9.v20150224 - 1.19.1 - 1.7.21 + 2.22.2 4.12 + 1.1.7 2.5 + 3.1.7 UTF-8 - 3.2.1.RELEASE - 2.7.15 - - 1.2 - 2.2 - 1.5.10 - 2.1.4 - 2.10.4 - 2.3.4 - 2.5 - 1.13 - 2.1 - 2.4.2 - 2.4.2 - 1.0.1 - - 4.8.1 - 1.0.0 - 3.2.1 - 1.6.3 - 2.1.3 - 8.1.11.v20130520 - 3.1.5 - 0.90 - 0.90 - 0 - diff --git a/samples/server/petstore/jaxrs/jersey2/pom.xml b/samples/server/petstore/jaxrs/jersey2/pom.xml index bc2bc84665..5f3f512a42 100644 --- a/samples/server/petstore/jaxrs/jersey2/pom.xml +++ b/samples/server/petstore/jaxrs/jersey2/pom.xml @@ -124,6 +124,14 @@ jersey-media-multipart ${jersey2-version} + + + com.brsanthu + migbase64 + 2.2 + + + diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java index 40d9a325be..b47b9daa7d 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java @@ -75,8 +75,8 @@ public class FakeApi { } @GET - @Consumes({ "application/json" }) - @Produces({ "application/json" }) + @Consumes({ "*/*" }) + @Produces({ "*/*" }) @io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "", response = void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = void.class), diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java index f74f7d3d88..25d3c688b7 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -85,6 +110,7 @@ public class AdditionalPropertiesClass { return Objects.hash(mapProperty, mapOfMapProperty); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Animal.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Animal.java index de739ed501..bf237d9b68 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Animal.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -72,6 +97,7 @@ public class Animal { return Objects.hash(className, color); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/AnimalFarm.java index c2b0084d9c..7d6310bcb5 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/AnimalFarm.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -27,6 +52,7 @@ public class AnimalFarm extends ArrayList { return Objects.hash(super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 803eb69e16..514dc8c139 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -58,6 +83,7 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java index bebc247092..ed1c4eae81 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -58,6 +83,7 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayTest.java index 19464a99ac..b88dca900f 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ArrayTest.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -112,6 +137,7 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Cat.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Cat.java index 95bea57092..cb618f4b18 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Cat.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -52,6 +77,7 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Category.java index ba1ecfdb2b..3bbb55c96f 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Category.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -72,6 +97,7 @@ public class Category { return Objects.hash(id, name); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Client.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Client.java index fcb2b0a834..dd85b69488 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Client.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Client.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -50,6 +75,7 @@ public class Client { return Objects.hash(client); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Dog.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Dog.java index f807268875..c6b58b5220 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Dog.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -52,6 +77,7 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumArrays.java index 959b35e6b1..f9dae7c498 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumArrays.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -142,6 +167,7 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumClass.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumClass.java index d8ac42c487..7786ccdc58 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumClass.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumClass.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -23,7 +48,6 @@ public enum EnumClass { } @Override - @JsonValue public String toString() { return String.valueOf(value); } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumTest.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumTest.java index 446649217c..fb4c755f11 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/EnumTest.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -188,6 +213,7 @@ public class EnumTest { return Objects.hash(enumString, enumInteger, enumNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/FormatTest.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/FormatTest.java index 7c882eb3fe..1c09d9b83d 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/FormatTest.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -326,6 +351,7 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/HasOnlyReadOnly.java index 3f5492a2e6..3ed2e82690 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/HasOnlyReadOnly.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -54,6 +79,7 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/MapTest.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/MapTest.java index 9ef30a045d..06d5876ce6 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/MapTest.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -117,6 +142,7 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 5a55ab81d6..4691a6be9b 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -104,6 +129,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Model200Response.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Model200Response.java index 09ad4d0d60..3221e2e3c6 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Model200Response.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -73,6 +98,7 @@ public class Model200Response { return Objects.hash(name, propertyClass); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ModelApiResponse.java index 82f447004e..6ac7d14a1f 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -94,6 +119,7 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ModelReturn.java index 884a45c598..afdea1f37d 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ModelReturn.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -51,6 +76,7 @@ public class ModelReturn { return Objects.hash(_return); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Name.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Name.java index 09085fb52d..ad4b96845a 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Name.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Name.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -99,6 +124,7 @@ public class Name { return Objects.hash(name, snakeCase, property, _123Number); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/NumberOnly.java index 9424f7a4b5..f88928c72a 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/NumberOnly.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -51,6 +76,7 @@ public class NumberOnly { return Objects.hash(justNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Order.java index 1dfe20badf..066e07c882 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Order.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -195,6 +220,7 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Pet.java index 823d25e05a..570ea39609 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Pet.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -208,6 +233,7 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ReadOnlyFirst.java index 50a2a7e418..94030bc0d7 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ReadOnlyFirst.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -63,6 +88,7 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/SpecialModelName.java index 2cdc99de90..d5acd14ac6 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/SpecialModelName.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -50,6 +75,7 @@ public class SpecialModelName { return Objects.hash(specialPropertyName); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Tag.java index 846812a503..c8f9cec4a9 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Tag.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -72,6 +97,7 @@ public class Tag { return Objects.hash(id, name); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/User.java index 52c5fff826..d932649a4e 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/User.java @@ -1,3 +1,28 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.model; import java.util.Objects; @@ -204,6 +229,7 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @Override public String toString() { StringBuilder sb = new StringBuilder();