From ca0c35aa153df57e345ec22a572721880da0067b Mon Sep 17 00:00:00 2001 From: OmriHarary Date: Tue, 21 Aug 2018 04:17:31 -0400 Subject: [PATCH] [java-server] Fix improper quoting of default values for query parameters (#708) --- .../JavaJaxRS/cxf-cdi/queryParams.mustache | 2 +- .../JavaJaxRS/cxf/queryParams.mustache | 2 +- .../resources/JavaJaxRS/queryParams.mustache | 2 +- .../JavaJaxRS/resteasy/queryParams.mustache | 2 +- .../JavaJaxRS/spec/queryParams.mustache | 2 +- .../resources/JavaSpring/queryParams.mustache | 2 +- .../JavaVertXServer/apiVerticle.mustache | 2 +- .../main/resources/MSF4J/queryParams.mustache | 2 +- .../resources/java-pkmst/queryParams.mustache | 2 +- .../.openapi-generator/VERSION | 2 +- .../java/org/openapitools/model/Order.java | 5 +- .../gen/java/org/openapitools/model/Pet.java | 3 +- .../java-msf4j/.openapi-generator-ignore | 23 ++++ .../java-msf4j/.openapi-generator/VERSION | 2 +- .../org/openapitools/api/AnotherFakeApi.java | 6 +- .../api/AnotherFakeApiService.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 75 ++++++++---- .../org/openapitools/api/FakeApiService.java | 12 +- .../gen/java/org/openapitools/api/PetApi.java | 6 +- .../java/org/openapitools/api/StoreApi.java | 2 +- .../org/openapitools/model/AnimalFarm.java | 50 ++++++++ .../gen/java/org/openapitools/model/Cat.java | 2 +- .../org/openapitools/model/EnumArrays.java | 6 +- .../org/openapitools/model/EnumClass.java | 2 +- .../java/org/openapitools/model/EnumTest.java | 8 +- .../model/FileSchemaTestClass.java | 107 ++++++++++++++++++ .../java/org/openapitools/model/MapTest.java | 63 ++++++++++- .../java/org/openapitools/model/Order.java | 4 +- .../org/openapitools/model/OuterEnum.java | 2 +- .../gen/java/org/openapitools/model/Pet.java | 2 +- .../openapitools/model/StringBooleanMap.java | 49 ++++++++ .../api/impl/AnotherFakeApiServiceImpl.java | 2 +- .../api/impl/FakeApiServiceImpl.java | 20 +++- .../java-pkmst/.openapi-generator-ignore | 23 ++++ .../java-pkmst/.openapi-generator/VERSION | 2 +- samples/server/petstore/java-pkmst/Readme.md | 16 +-- samples/server/petstore/java-pkmst/pom.xml | 106 ++++++++--------- ...g.java => OpenAPIDocumentationConfig.java} | 2 +- .../com/prokarma/pkmst/controller/PetApi.java | 8 +- .../pkmst/controller/PetApiController.java | 41 ++++++- .../prokarma/pkmst/controller/StoreApi.java | 6 +- .../pkmst/controller/StoreApiController.java | 22 +++- .../prokarma/pkmst/controller/UserApi.java | 4 +- .../pkmst/controller/UserApiController.java | 10 ++ .../java/com/prokarma/pkmst/model/Order.java | 4 +- .../java/com/prokarma/pkmst/model/Pet.java | 2 +- .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application-local.yml | 2 +- .../async/.openapi-generator/VERSION | 2 +- .../openapitools/server/api/model/Order.java | 2 +- .../async/src/main/resources/openapi.json | 6 +- .../java-vertx/rx/.openapi-generator/VERSION | 2 +- .../openapitools/server/api/model/Order.java | 2 +- .../rx/src/main/resources/openapi.json | 6 +- 54 files changed, 588 insertions(+), 155 deletions(-) create mode 100644 samples/server/petstore/java-msf4j/.openapi-generator-ignore create mode 100644 samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/AnimalFarm.java create mode 100644 samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/FileSchemaTestClass.java create mode 100644 samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/StringBooleanMap.java create mode 100644 samples/server/petstore/java-pkmst/.openapi-generator-ignore rename samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/config/swagger/{SwaggerDocumentationConfig.java => OpenAPIDocumentationConfig.java} (98%) diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/queryParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/queryParams.mustache index c1c9e8b45cb3..48660b59a8ec 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{#defaultValue}}@DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) {{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/queryParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/queryParams.mustache index 6a98efdac02a..60ec7b9af894 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}}@DefaultValue("{{{defaultValue}}}") {{/defaultValue}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}) {{/defaultValue}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/queryParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/queryParams.mustache index 9055e6f16dc3..a8e45cd5f782 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}){{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/queryParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/queryParams.mustache index 292fbb4600f2..0fb3c78c63fd 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/queryParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/queryParams.mustache index 4434783a4611..279efb3cfa31 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache index 182152c6e5ae..97e90bafefe2 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{>optionalDataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) {{>optionalDataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaVertXServer/apiVerticle.mustache b/modules/openapi-generator/src/main/resources/JavaVertXServer/apiVerticle.mustache index ad95c3282574..66d7f51f8c53 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXServer/apiVerticle.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXServer/apiVerticle.mustache @@ -68,7 +68,7 @@ public class {{classname}}Verticle extends AbstractVerticle { {{{dataType}}} {{paramName}} = {{paramName}}Param; {{/required}} {{^required}} - {{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{defaultValue}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : {{paramName}}Param; + {{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{#isEnum}}"{{/isEnum}}{{{defaultValue}}}{{#isEnum}}"{{/isEnum}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : {{paramName}}Param; {{/required}} {{/isString}} {{^isString}} diff --git a/modules/openapi-generator/src/main/resources/MSF4J/queryParams.mustache b/modules/openapi-generator/src/main/resources/MSF4J/queryParams.mustache index 9055e6f16dc3..a8e45cd5f782 100644 --- a/modules/openapi-generator/src/main/resources/MSF4J/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/MSF4J/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}){{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/queryParams.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/queryParams.mustache index 182152c6e5ae..97e90bafefe2 100644 --- a/modules/openapi-generator/src/main/resources/java-pkmst/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/java-pkmst/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{>optionalDataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) {{>optionalDataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/samples/client/petstore/jaxrs-cxf-client/.openapi-generator/VERSION b/samples/client/petstore/jaxrs-cxf-client/.openapi-generator/VERSION index 096bf47efe31..4395ff592326 100644 --- a/samples/client/petstore/jaxrs-cxf-client/.openapi-generator/VERSION +++ b/samples/client/petstore/jaxrs-cxf-client/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.2.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/org/openapitools/model/Order.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/org/openapitools/model/Order.java index 3aa2ec3d55c3..b2725e076bc9 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/org/openapitools/model/Order.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/org/openapitools/model/Order.java @@ -31,7 +31,6 @@ public class Order { @ApiModelProperty(value = "") private Date shipDate = null; - @XmlType(name="StatusEnum") @XmlEnum(String.class) public enum StatusEnum { @@ -60,7 +59,7 @@ public enum StatusEnum { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + v + "'"); } } @@ -170,7 +169,7 @@ public enum StatusEnum { * @return complete **/ @JsonProperty("complete") - public Boolean isComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/org/openapitools/model/Pet.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/org/openapitools/model/Pet.java index c7e7cda691e2..f6faecaf750d 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/org/openapitools/model/Pet.java @@ -37,7 +37,6 @@ public class Pet { @ApiModelProperty(value = "") private List tags = null; - @XmlType(name="StatusEnum") @XmlEnum(String.class) public enum StatusEnum { @@ -66,7 +65,7 @@ public enum StatusEnum { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + v + "'"); } } diff --git a/samples/server/petstore/java-msf4j/.openapi-generator-ignore b/samples/server/petstore/java-msf4j/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/java-msf4j/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/java-msf4j/.openapi-generator/VERSION b/samples/server/petstore/java-msf4j/.openapi-generator/VERSION index 096bf47efe31..4395ff592326 100644 --- a/samples/server/petstore/java-msf4j/.openapi-generator/VERSION +++ b/samples/server/petstore/java-msf4j/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.2.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/AnotherFakeApi.java index 5b24bbcf8bbd..7d9e784b789e 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -34,12 +34,12 @@ public class AnotherFakeApi { @Path("/dummy") @Consumes({ "application/json" }) @Produces({ "application/json" }) - @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response testSpecialTags(@ApiParam(value = "client model" ,required=true) Client client + public Response call123testSpecialTags(@ApiParam(value = "client model" ,required=true) Client client ) throws NotFoundException { - return delegate.testSpecialTags(client); + return delegate.call123testSpecialTags(client); } } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/AnotherFakeApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/AnotherFakeApiService.java index 11a505717d28..ccce96eba566 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/AnotherFakeApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/AnotherFakeApiService.java @@ -18,6 +18,6 @@ import javax.ws.rs.core.SecurityContext; public abstract class AnotherFakeApiService { - public abstract Response testSpecialTags(Client client + public abstract Response call123testSpecialTags(Client client ) throws NotFoundException; } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApi.java index fd1699a7c5f9..876d1a151e3c 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApi.java @@ -11,7 +11,9 @@ import java.math.BigDecimal; import org.openapitools.model.Client; import java.util.Date; import java.io.File; +import org.openapitools.model.FileSchemaTestClass; import java.util.Map; +import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; import org.openapitools.model.User; @@ -43,10 +45,10 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) - public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean booleanPostBody + public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean body ) throws NotFoundException { - return delegate.fakeOuterBooleanSerialize(booleanPostBody); + return delegate.fakeOuterBooleanSerialize(body); } @POST @Path("/outer/composite") @@ -85,6 +87,18 @@ public class FakeApi { return delegate.fakeOuterStringSerialize(body); } @PUT + @Path("/body-with-file-schema") + @Consumes({ "application/json" }) + + @io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) + public Response testBodyWithFileSchema(@ApiParam(value = "" ,required=true) FileSchemaTestClass fileSchemaTestClass +) + throws NotFoundException { + return delegate.testBodyWithFileSchema(fileSchemaTestClass); + } + @PUT @Path("/body-with-query-params") @Consumes({ "application/json" }) @@ -120,22 +134,22 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number -,@ApiParam(value = "None", required=true) @FormParam("double") Double _double -,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter -,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte -,@ApiParam(value = "None", allowableValues="range=[10, 100]") @FormParam("integer") Integer integer -,@ApiParam(value = "None", allowableValues="range=[20, 200]") @FormParam("int32") Integer int32 -,@ApiParam(value = "None") @FormParam("int64") Long int64 -,@ApiParam(value = "None") @FormParam("float") Float _float -,@ApiParam(value = "None") @FormParam("string") String string + public Response testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("number") BigDecimal number +,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("double") Double _double +,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("pattern_without_delimiter") String patternWithoutDelimiter +,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("byte") byte[] _byte +,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("integer") Integer integer +,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int32") Integer int32 +,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int64") Long int64 +,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("float") Float _float +,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("string") String string , @FormDataParam("binary") InputStream binaryInputStream, @FormDataParam("binary") FileInfo binaryDetail -,@ApiParam(value = "None") @FormParam("date") Date date -,@ApiParam(value = "None") @FormParam("dateTime") Date dateTime -,@ApiParam(value = "None") @FormParam("password") String password -,@ApiParam(value = "None") @FormParam("callback") String paramCallback +,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("date") Date date +,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("dateTime") Date dateTime +,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("password") String password +,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("callback") String paramCallback ) throws NotFoundException { return delegate.testEndpointParameters(number,_double,patternWithoutDelimiter,_byte,integer,int32,int64,_float,string,binaryInputStream, binaryDetail,date,dateTime,password,paramCallback); @@ -155,8 +169,8 @@ public class FakeApi { ,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString ,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger ,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble -,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @FormParam("enum_form_string_array") List enumFormStringArray -,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)") @FormParam("enum_form_string") String enumFormString +,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @DefaultValue("$") @FormParam("enum_form_string_array") List enumFormStringArray +,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @FormParam("enum_form_string") String enumFormString ) throws NotFoundException { return delegate.testEnumParameters(enumHeaderStringArray,enumHeaderString,enumQueryStringArray,enumQueryString,enumQueryInteger,enumQueryDouble,enumFormStringArray,enumFormString); @@ -168,7 +182,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) String requestBody + public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) Map requestBody ) throws NotFoundException { return delegate.testInlineAdditionalProperties(requestBody); @@ -180,10 +194,31 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param -,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2 + public Response testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param") String param +,@ApiParam(value = "field2", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param2") String param2 ) throws NotFoundException { return delegate.testJsonFormData(param,param2); } + @POST + @Path("/{petId}/uploadImageWithRequiredFile") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "uploads an image (required)", notes = "", response = ModelApiResponse.class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + public Response uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId +, + @FormDataParam("requiredFile") InputStream requiredFileInputStream, + @FormDataParam("requiredFile") FileInfo requiredFileDetail +,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata +) + throws NotFoundException { + return delegate.uploadFileWithRequiredFile(petId,requiredFileInputStream, requiredFileDetail,additionalMetadata); + } } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApiService.java index 7ace08f487d9..9647200f6f05 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/FakeApiService.java @@ -10,7 +10,9 @@ import java.math.BigDecimal; import org.openapitools.model.Client; import java.util.Date; import java.io.File; +import org.openapitools.model.FileSchemaTestClass; import java.util.Map; +import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; import org.openapitools.model.User; @@ -24,13 +26,15 @@ import javax.ws.rs.core.SecurityContext; public abstract class FakeApiService { - public abstract Response fakeOuterBooleanSerialize(Boolean booleanPostBody + public abstract Response fakeOuterBooleanSerialize(Boolean body ) throws NotFoundException; public abstract Response fakeOuterCompositeSerialize(OuterComposite outerComposite ) throws NotFoundException; public abstract Response fakeOuterNumberSerialize(BigDecimal body ) throws NotFoundException; public abstract Response fakeOuterStringSerialize(String body + ) throws NotFoundException; + public abstract Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass ) throws NotFoundException; public abstract Response testBodyWithQueryParams(String query ,User user @@ -61,9 +65,13 @@ public abstract class FakeApiService { ,List enumFormStringArray ,String enumFormString ) throws NotFoundException; - public abstract Response testInlineAdditionalProperties(String requestBody + public abstract Response testInlineAdditionalProperties(Map requestBody ) throws NotFoundException; public abstract Response testJsonFormData(String param ,String param2 + ) throws NotFoundException; + public abstract Response uploadFileWithRequiredFile(Long petId + ,InputStream requiredFileInputStream, FileInfo requiredFileDetail + ,String additionalMetadata ) throws NotFoundException; } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/PetApi.java index dbce159ab076..e4b54cbab65e 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/PetApi.java @@ -157,8 +157,8 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId -,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name -,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status +,@ApiParam(value = "Updated name of the pet", defaultValue="null") @DefaultValue("null") @FormParam("name") String name +,@ApiParam(value = "Updated status of the pet", defaultValue="null") @DefaultValue("null") @FormParam("status") String status ) throws NotFoundException { return delegate.updatePetWithForm(petId,name,status); @@ -176,7 +176,7 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId -,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata +,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata , @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FileInfo fileDetail diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/StoreApi.java index c657b4ee3766..0a093d51ba92 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/StoreApi.java @@ -69,7 +69,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) }) - public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true, allowableValues="range=[1, 5]") @PathParam("order_id") Long orderId + public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("order_id") Long orderId ) throws NotFoundException { return delegate.getOrderById(orderId); diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/AnimalFarm.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/AnimalFarm.java new file mode 100644 index 000000000000..fd690d2791c0 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/AnimalFarm.java @@ -0,0 +1,50 @@ +package org.openapitools.model; + +import java.util.Objects; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.model.Animal; + +/** + * AnimalFarm + */ + +public class AnimalFarm extends ArrayList { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Cat.java index 1f551dd586c3..4a180ffed1e7 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Cat.java @@ -25,7 +25,7 @@ public class Cat extends Animal { * @return declawed **/ @ApiModelProperty(value = "") - public Boolean isDeclawed() { + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumArrays.java index ad415532b6ca..01c730beb10c 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumArrays.java @@ -41,7 +41,7 @@ public class EnumArrays { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } @@ -75,10 +75,10 @@ public class EnumArrays { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } - + @JsonProperty("array_enum") private List arrayEnum = null; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumClass.java index a9e44e5da95b..92745f9c2543 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumClass.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumClass.java @@ -35,7 +35,7 @@ public enum EnumClass { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumTest.java index baeca0e7c1c2..5819202313a5 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/EnumTest.java @@ -42,7 +42,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } @@ -78,7 +78,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } @@ -112,7 +112,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } @@ -146,7 +146,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..4e05197cd03a --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -0,0 +1,107 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +/** + * FileSchemaTestClass + */ + +public class FileSchemaTestClass { + @JsonProperty("file") + private java.io.File file = null; + + @JsonProperty("files") + private List files = null; + + public FileSchemaTestClass file(java.io.File file) { + this.file = file; + return this; + } + + /** + * Get file + * @return file + **/ + @ApiModelProperty(value = "") + public java.io.File getFile() { + return file; + } + + public void setFile(java.io.File file) { + this.file = file; + } + + public FileSchemaTestClass files(List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + if (this.files == null) { + this.files = new ArrayList(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @ApiModelProperty(value = "") + public List getFiles() { + return files; + } + + public void setFiles(List files) { + this.files = files; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(file, files); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MapTest.java index f57655fee856..a836094ca56a 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/MapTest.java @@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openapitools.model.StringBooleanMap; /** * MapTest @@ -45,13 +46,19 @@ public class MapTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } - + @JsonProperty("map_of_enum_string") private Map mapOfEnumString = null; + @JsonProperty("direct_map") + private Map directMap = null; + + @JsonProperty("indirect_map") + private StringBooleanMap indirectMap = null; + public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; return this; @@ -104,6 +111,50 @@ public class MapTest { this.mapOfEnumString = mapOfEnumString; } + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @ApiModelProperty(value = "") + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest indirectMap(StringBooleanMap indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @ApiModelProperty(value = "") + public StringBooleanMap getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(StringBooleanMap indirectMap) { + this.indirectMap = indirectMap; + } + @Override public boolean equals(java.lang.Object o) { @@ -115,12 +166,14 @@ public class MapTest { } MapTest mapTest = (MapTest) o; return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && - Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString); + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); } @Override public int hashCode() { - return Objects.hash(mapMapOfString, mapOfEnumString); + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } @Override @@ -130,6 +183,8 @@ public class MapTest { sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Order.java index 859e49bbaff2..aa1bea44ccc5 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Order.java @@ -54,7 +54,7 @@ public class Order { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } @@ -164,7 +164,7 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") - public Boolean isComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/OuterEnum.java index 234c92ff2441..60fb9d936d22 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/OuterEnum.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/OuterEnum.java @@ -35,7 +35,7 @@ public enum OuterEnum { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Pet.java index 25a332997ad0..18c5d3428492 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/Pet.java @@ -60,7 +60,7 @@ public class Pet { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/StringBooleanMap.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/StringBooleanMap.java new file mode 100644 index 000000000000..2e29c971f48c --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/StringBooleanMap.java @@ -0,0 +1,49 @@ +package org.openapitools.model; + +import java.util.Objects; +import java.util.HashMap; +import java.util.Map; + +/** + * StringBooleanMap + */ + +public class StringBooleanMap extends HashMap { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringBooleanMap {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java index 16e377cce92b..071e285e33c1 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java @@ -19,7 +19,7 @@ import javax.ws.rs.core.SecurityContext; public class AnotherFakeApiServiceImpl extends AnotherFakeApiService { @Override - public Response testSpecialTags(Client client + public Response call123testSpecialTags(Client client ) 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/org/openapitools/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java index f2efccf5d1da..583ea8ee1dbc 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java @@ -7,7 +7,9 @@ import java.math.BigDecimal; import org.openapitools.model.Client; import java.util.Date; import java.io.File; +import org.openapitools.model.FileSchemaTestClass; import java.util.Map; +import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; import org.openapitools.model.User; @@ -25,7 +27,7 @@ import javax.ws.rs.core.SecurityContext; public class FakeApiServiceImpl extends FakeApiService { @Override - public Response fakeOuterBooleanSerialize(Boolean booleanPostBody + public Response fakeOuterBooleanSerialize(Boolean body ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); @@ -44,6 +46,12 @@ public class FakeApiServiceImpl extends FakeApiService { } @Override public Response fakeOuterStringSerialize(String body + ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); @@ -94,7 +102,7 @@ public class FakeApiServiceImpl extends FakeApiService { return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response testInlineAdditionalProperties(String requestBody + public Response testInlineAdditionalProperties(Map requestBody ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); @@ -102,6 +110,14 @@ public class FakeApiServiceImpl extends FakeApiService { @Override public Response testJsonFormData(String param , String param2 + ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response uploadFileWithRequiredFile(Long petId +, InputStream requiredFileInputStream, FileInfo requiredFileDetail +, String additionalMetadata ) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); diff --git a/samples/server/petstore/java-pkmst/.openapi-generator-ignore b/samples/server/petstore/java-pkmst/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/java-pkmst/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/java-pkmst/.openapi-generator/VERSION b/samples/server/petstore/java-pkmst/.openapi-generator/VERSION index 096bf47efe31..4395ff592326 100644 --- a/samples/server/petstore/java-pkmst/.openapi-generator/VERSION +++ b/samples/server/petstore/java-pkmst/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.2.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-pkmst/Readme.md b/samples/server/petstore/java-pkmst/Readme.md index ebef7835e7c7..9867e11590b6 100644 --- a/samples/server/petstore/java-pkmst/Readme.md +++ b/samples/server/petstore/java-pkmst/Readme.md @@ -17,20 +17,20 @@ g)Allow you to integrate with tracing server (Example Zipkin) h)Allow you to capture log in your microservice and send to Log management server (Ex ELK or splunk) i)Allow you to configure Oauth2 security based authorization for your microservice - Additonal Features + Additional Features j)generate sample cucumber file and dependency to drive your Behaviour driven development. - k)generate gatling based perfromance test , which can be excuted via build pipeline like jenkins etc. + k)generate gatling based performance test, which can be excuted via build pipeline like jenkins etc. Working: -Using swagger specification you can convert any definition to spring boot microservice. +Using OpenAPI specification you can convert any definition to spring boot microservice. It has the integration with the below services: eureka registry, zipkin , spring boot admin, circuit breaker. By default only the circuit breaker annotation is enabled. But one has to write the fallback method. The needed dependency for it is also been enabled. To generate the integration and related configuration for eureka, zipkin, spring boot admin one has two options: -1) When generating from UI one has to provide vendor extensions inside the swagger specification as below: +1) When generating from UI one has to provide vendor extensions inside the OpenAPI specification as below: swagger: "2.0" info: description: "This is a sample Product Catalogue Server.\ @@ -43,11 +43,11 @@ info: springBootAdminUri: "http://localhost:8000" pkmstInterceptor: "true" -PLease note the vendor extensions are inside the info tag of the swagger specification. All the tags are case sensitive. Once given all the related configuration and the dependency +PLease note the vendor extensions are inside the info tag of the OpenAPI specification. All the tags are case sensitive. Once given all the related configuration and the dependency will be enabled. 2) When generating from the maven plugin one has to provide configuration inside pom as below: -inside the swagger codegen maven plugin under the configuration section +inside the openapi generator maven plugin under the configuration section product-openapi.yaml @@ -136,7 +136,7 @@ HttpLogging filter is provided for logging in the request and response. Can be f Spring security is also provided to secure the resources. Please modify according to your needs. First run: -Import the project in to the eclipse. Run the app as an spring boot application.The project will run on http://localhost:8008 +Import the project in to the eclipse. Run the app as a spring boot application.The project will run on http://localhost:8008 Swagger ui available on: http://localhost:8008/swagger-ui.html If all the configurations have been enabled(depending on the port) below are some of the URls to access: @@ -152,4 +152,4 @@ Pkmst examples https://github.com/ProKarma-Inc/pkmst-getting-started-examples Pkmst Extensions -https://github.com/ProKarma-Inc/pkmst-extention \ No newline at end of file +https://github.com/ProKarma-Inc/pkmst-extention diff --git a/samples/server/petstore/java-pkmst/pom.xml b/samples/server/petstore/java-pkmst/pom.xml index 5ca43f8a6f06..8a62b880bf6c 100644 --- a/samples/server/petstore/java-pkmst/pom.xml +++ b/samples/server/petstore/java-pkmst/pom.xml @@ -52,10 +52,10 @@ false - - jitpack.io - https://jitpack.io - + + jitpack.io + https://jitpack.io + @@ -83,35 +83,35 @@ + org.springframework.cloud + spring-cloud-starter-sleuth + --> + org.springframework.cloud spring-cloud-starter-sleuth + org.springframework.cloud spring-cloud-stream-binder-rabbit + --> + org.springframework.cloud spring-cloud-starter-sleuth + org.springframework.cloud spring-cloud-stream-binder-rabbit + --> org.springframework.boot spring-boot-starter-actuator - org.springframework.boot - spring-boot-starter-jetty + org.springframework.boot + spring-boot-starter-jetty + org.springframework.cloud + spring-cloud-netflix-hystrix-stream + + + org.springframework.cloud + spring-cloud-starter-bus-amqp + --> org.springframework.cloud spring-cloud-starter-hystrix-dashboard @@ -229,11 +229,11 @@ org.springframework spring-test - - org.threeten - threetenbp - 1.3.6 - + + org.threeten + threetenbp + 1.3.6 + @@ -263,7 +263,7 @@ **/*CucumberTest*.java + an example --> **/cucumber/*.java @@ -275,28 +275,28 @@ ${scala-maven-plugin.version} - + org.springframework.boot spring-boot-maven-plugin @@ -350,9 +350,9 @@ 2.19.1 - org.apache.maven.plugins - maven-pmd-plugin - + org.apache.maven.plugins + maven-pmd-plugin + diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/config/swagger/SwaggerDocumentationConfig.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/config/swagger/OpenAPIDocumentationConfig.java similarity index 98% rename from samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/config/swagger/SwaggerDocumentationConfig.java rename to samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/config/swagger/OpenAPIDocumentationConfig.java index 67599c9bb45c..dac5a9cdd15f 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/config/swagger/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/config/swagger/OpenAPIDocumentationConfig.java @@ -20,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; */ @EnableSwagger2 @Configuration -public class SwaggerDocumentationConfig { +public class OpenAPIDocumentationConfig { public static final String DEFAULT_INCLUDE_PATTERN = "/pkmst/.*"; @Bean diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApi.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApi.java index ae6b11d018f8..2c6ab41a0ca7 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApi.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApi.java @@ -1,6 +1,6 @@ /** - * NOTE: This class is auto generated by the swagger code generator program (3.0.0-SNAPSHOT). - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.2.0-SNAPSHOT). + * https://openapi-generator.tech * Do not edit the class manually. */ package com.prokarma.pkmst.controller; @@ -128,7 +128,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestPart(value="status", required=false) String status, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -143,6 +143,6 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; } diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApiController.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApiController.java index 28752172722b..efd55c865beb 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApiController.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApiController.java @@ -50,18 +50,48 @@ public class PetApiController implements PetApi { public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity>(objectMapper.readValue("", List.class), HttpStatus.OK); + } + + + if (accept != null && accept.contains("application/xml")) { + return new ResponseEntity>(objectMapper.readValue("", List.class), HttpStatus.OK); + } + return new ResponseEntity>(HttpStatus.OK); } public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity>(objectMapper.readValue("", List.class), HttpStatus.OK); + } + + + if (accept != null && accept.contains("application/xml")) { + return new ResponseEntity>(objectMapper.readValue("", List.class), HttpStatus.OK); + } + return new ResponseEntity>(HttpStatus.OK); } public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("", Pet.class), HttpStatus.OK); + } + + + if (accept != null && accept.contains("application/xml")) { + return new ResponseEntity(objectMapper.readValue("", Pet.class), HttpStatus.OK); + } + return new ResponseEntity(HttpStatus.OK); } @@ -72,18 +102,23 @@ public class PetApiController implements PetApi { } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, + @ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestPart(value="name", required=false) String name, + @ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestPart(value="status", required=false) String status, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, + @ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("", ModelApiResponse.class), HttpStatus.OK); + } + return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApi.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApi.java index be3ff14ebf64..7c630ee61a3a 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApi.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApi.java @@ -1,6 +1,6 @@ /** - * NOTE: This class is auto generated by the swagger code generator program (3.0.0-SNAPSHOT). - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.2.0-SNAPSHOT). + * https://openapi-generator.tech * Do not edit the class manually. */ package com.prokarma.pkmst.controller; @@ -58,7 +58,7 @@ public interface StoreApi { @RequestMapping(value = "/store/order/{orderId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true, allowableValues="{min=1, max=5}" ) @PathVariable("orderId") Long orderId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApiController.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApiController.java index 6c5faee23f2e..16af6cd0225a 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApiController.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApiController.java @@ -44,15 +44,35 @@ public class StoreApiController implements StoreApi { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true, allowableValues="{min=1, max=5}" ) @PathVariable("orderId") Long orderId, + public ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("", Order.class), HttpStatus.OK); + } + + + if (accept != null && accept.contains("application/xml")) { + return new ResponseEntity(objectMapper.readValue("", Order.class), HttpStatus.OK); + } + return new ResponseEntity(HttpStatus.OK); } public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order order, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("", Order.class), HttpStatus.OK); + } + + + if (accept != null && accept.contains("application/xml")) { + return new ResponseEntity(objectMapper.readValue("", Order.class), HttpStatus.OK); + } + return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApi.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApi.java index f81441045ebb..7f19b8793c6a 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApi.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApi.java @@ -1,6 +1,6 @@ /** - * NOTE: This class is auto generated by the swagger code generator program (3.0.0-SNAPSHOT). - * https://github.com/swagger-api/swagger-codegen + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.2.0-SNAPSHOT). + * https://openapi-generator.tech * Do not edit the class manually. */ package com.prokarma.pkmst.controller; diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApiController.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApiController.java index 8ba2847e32e1..3dc6cf94c8fc 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApiController.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApiController.java @@ -60,6 +60,16 @@ public class UserApiController implements UserApi { public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true ) @PathVariable("username") String username, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("", User.class), HttpStatus.OK); + } + + + if (accept != null && accept.contains("application/xml")) { + return new ResponseEntity(objectMapper.readValue("", User.class), HttpStatus.OK); + } + return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Order.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Order.java index b35a9f4352d2..fdd99f797c96 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Order.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Order.java @@ -60,7 +60,7 @@ public class Order { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } @@ -170,7 +170,7 @@ public class Order { * @return complete **/ @ApiModelProperty(value = "") - public Boolean isComplete() { + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Pet.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Pet.java index 567928272c34..f5cb40a2b1b0 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Pet.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Pet.java @@ -68,7 +68,7 @@ public class Pet { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + text + "'"); } } diff --git a/samples/server/petstore/java-pkmst/src/main/resources/application-dev.yml b/samples/server/petstore/java-pkmst/src/main/resources/application-dev.yml index fecadb4b3ab2..13ef356233ca 100644 --- a/samples/server/petstore/java-pkmst/src/main/resources/application-dev.yml +++ b/samples/server/petstore/java-pkmst/src/main/resources/application-dev.yml @@ -1,6 +1,6 @@ # Discovery Server Access server: - port: -1 + port: 8080 # Spring Actuator management: diff --git a/samples/server/petstore/java-pkmst/src/main/resources/application-local.yml b/samples/server/petstore/java-pkmst/src/main/resources/application-local.yml index c314f6e7a300..57e184773b0d 100644 --- a/samples/server/petstore/java-pkmst/src/main/resources/application-local.yml +++ b/samples/server/petstore/java-pkmst/src/main/resources/application-local.yml @@ -1,6 +1,6 @@ # Discovery Server Access server: - port: -1 + port: 8080 # Spring Actuator management: diff --git a/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION b/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION index 096bf47efe31..4395ff592326 100644 --- a/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION +++ b/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.2.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java index 1815414b55da..f34e4c0ff4f6 100644 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java +++ b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java @@ -99,7 +99,7 @@ public class Order { @JsonProperty("complete") - public Boolean isComplete() { + public Boolean getComplete() { return complete; } public void setComplete(Boolean complete) { diff --git a/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json b/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json index eeb13a4729fb..fab44c6d95a2 100644 --- a/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json +++ b/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json @@ -112,13 +112,14 @@ "in" : "query", "description" : "Status values that need to be considered for filter", "required" : true, + "style" : "form", "explode" : false, "schema" : { "type" : "array", "items" : { "type" : "string", - "default" : "available", - "enum" : [ "available", "pending", "sold" ] + "enum" : [ "available", "pending", "sold" ], + "default" : "available" } } } ], @@ -168,6 +169,7 @@ "in" : "query", "description" : "Tags to filter by", "required" : true, + "style" : "form", "explode" : false, "schema" : { "type" : "array", diff --git a/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION b/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION index 096bf47efe31..4395ff592326 100644 --- a/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION +++ b/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.2.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java index 1815414b55da..f34e4c0ff4f6 100644 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java +++ b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java @@ -99,7 +99,7 @@ public class Order { @JsonProperty("complete") - public Boolean isComplete() { + public Boolean getComplete() { return complete; } public void setComplete(Boolean complete) { diff --git a/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json b/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json index eeb13a4729fb..fab44c6d95a2 100644 --- a/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json +++ b/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json @@ -112,13 +112,14 @@ "in" : "query", "description" : "Status values that need to be considered for filter", "required" : true, + "style" : "form", "explode" : false, "schema" : { "type" : "array", "items" : { "type" : "string", - "default" : "available", - "enum" : [ "available", "pending", "sold" ] + "enum" : [ "available", "pending", "sold" ], + "default" : "available" } } } ], @@ -168,6 +169,7 @@ "in" : "query", "description" : "Tags to filter by", "required" : true, + "style" : "form", "explode" : false, "schema" : { "type" : "array",