From 147497ae3448c0508147cc225b11bfc001999905 Mon Sep 17 00:00:00 2001 From: David Biesack Date: Tue, 31 May 2016 15:57:40 -0400 Subject: [PATCH 1/5] use {{name}} not {{classname}} in HTML seaction head/anchors --- .../src/main/resources/htmlDocs/index.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache index ad22284d4e45..26f7f564ff57 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache @@ -156,7 +156,7 @@
    {{#models}} {{#model}} -
  1. {{classname}}
  2. +
  3. {{name}}
  4. {{/model}} {{/models}}
@@ -164,7 +164,7 @@ {{#models}} {{#model}}
-

{{classname}} Up

+

{{name}} Up

{{#vars}}
{{name}} {{^required}}(optional){{/required}}
{{^isPrimitiveType}}{{datatype}}{{/isPrimitiveType}} {{description}}
{{#isEnum}} From 2ead00c96d9d24372e6b827c6f1e1e2a3414fd8c Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Wed, 1 Jun 2016 15:51:52 +0200 Subject: [PATCH 2/5] [Objc] Add customizable user-agent #2715 --- .../src/main/resources/objc/Configuration-body.mustache | 3 ++- .../client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache b/modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache index e37551bf8a1c..1aeca25dd3e4 100644 --- a/modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache @@ -10,7 +10,7 @@ @implementation {{classPrefix}}Configuration -#pragma mark - Singletion Methods +#pragma mark - Singleton Methods + (instancetype) sharedConfig { static {{classPrefix}}Configuration *shardConfig = nil; @@ -35,6 +35,7 @@ self.mutableApiKey = [NSMutableDictionary dictionary]; self.mutableApiKeyPrefix = [NSMutableDictionary dictionary]; self.mutableDefaultHeaders = [NSMutableDictionary dictionary]; + self.mutableDefaultHeaders[@"User-Agent"] = {{#httpUserAgent}}@"{{httpUserAgent}}"{{/httpUserAgent}}{{^httpUserAgent}}[NSString stringWithFormat:@"Swagger-Codegen/{{version}}/objc (%@; iOS %@; Scale/%0.2f)",[[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]]{{/httpUserAgent}}; self.logger = [{{classPrefix}}Logger sharedLogger]; } return self; diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m b/samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m index cd8d6e7aeef7..24172638bba6 100644 --- a/samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m +++ b/samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m @@ -10,7 +10,7 @@ @implementation SWGConfiguration -#pragma mark - Singletion Methods +#pragma mark - Singleton Methods + (instancetype) sharedConfig { static SWGConfiguration *shardConfig = nil; @@ -35,6 +35,7 @@ self.mutableApiKey = [NSMutableDictionary dictionary]; self.mutableApiKeyPrefix = [NSMutableDictionary dictionary]; self.mutableDefaultHeaders = [NSMutableDictionary dictionary]; + self.mutableDefaultHeaders[@"User-Agent"] = [NSString stringWithFormat:@"Swagger-Codegen/1.0.0/objc (%@; iOS %@; Scale/%0.2f)",[[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]]; self.logger = [SWGLogger sharedLogger]; } return self; From 23d2c5609694a4cde1f91648a81bd2d2c598376c Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 2 Jun 2016 14:33:08 +0800 Subject: [PATCH 3/5] [JAX-RS] fix library setting "jersey2" (#3016) * to fix #2981 * update sample, update ci to include jaxrs (jersey1, 2) * avoid duplicated artifactId in pom (jaxrs jersey1) * update jetty dependency for jersey1 jaxrs * update bin to set proper artifact-id * fix jersey1 jaxrs pom.xml * fix dependency in jaxrs jersey2 pom * downgrade jetty plugin to 9.3.0.v20150612 * update petstore sample for jaxrs jersey 1 * restore jetty to previous version. update test order * downgrade jetty maven plugin version * restore original version of jetty plugin --- bin/jaxrs-jersey1-petstore-server.sh | 31 +++ bin/jaxrs-petstore-server.sh | 2 +- .../AbstractJavaJAXRSServerCodegen.java | 8 +- .../languages/JavaJerseyServerCodegen.java | 67 +++--- .../jersey1}/ApiException.mustache | 0 .../jersey1}/ApiOriginFilter.mustache | 0 .../jersey1}/ApiResponseMessage.mustache | 0 .../jersey1}/JodaDateTimeProvider.mustache | 0 .../jersey1}/JodaLocalDateProvider.mustache | 0 .../jersey1}/LocalDateProvider.mustache | 0 .../jersey1}/LocalDateTimeProvider.mustache | 0 .../jersey1}/NotFoundException.mustache | 0 .../jersey1}/README.mustache | 0 .../jersey1}/StringUtil.mustache | 0 .../jersey1}/allowableValues.mustache | 0 .../jersey1}/api.mustache | 0 .../jersey1}/apiService.mustache | 0 .../jersey1}/apiServiceFactory.mustache | 0 .../jersey1}/apiServiceImpl.mustache | 0 .../jersey1}/bodyParams.mustache | 0 .../jersey1}/bootstrap.mustache | 0 .../jersey1}/enumClass.mustache | 0 .../jersey1}/enumOuterClass.mustache | 0 .../jersey1}/formParams.mustache | 0 .../jersey1}/generatedAnnotation.mustache | 0 .../jersey1}/headerParams.mustache | 0 .../jersey1}/jacksonJsonProvider.mustache | 0 .../jersey1}/model.mustache | 2 + .../jersey1}/pathParams.mustache | 0 .../jersey1}/pojo.mustache | 0 .../jersey1}/pom.mustache | 11 +- .../jersey1}/project/build.properties | 0 .../jersey1}/project/plugins.sbt | 0 .../jersey1}/queryParams.mustache | 0 .../jersey1}/returnTypes.mustache | 0 .../jersey1}/serviceBodyParams.mustache | 0 .../jersey1}/serviceFormParams.mustache | 0 .../jersey1}/serviceHeaderParams.mustache | 0 .../jersey1}/servicePathParams.mustache | 0 .../jersey1}/serviceQueryParams.mustache | 0 .../jersey1}/web.mustache | 0 .../jersey2/ApiException.mustache | 0 .../jersey2/ApiOriginFilter.mustache | 0 .../jersey2/ApiResponseMessage.mustache | 0 .../jersey2/JodaDateTimeProvider.mustache | 0 .../jersey2/JodaLocalDateProvider.mustache | 0 .../jersey2/LocalDateProvider.mustache | 0 .../jersey2/LocalDateTimeProvider.mustache | 0 .../jersey2/NotFoundException.mustache | 0 .../{ => libraries}/jersey2/README.mustache | 0 .../jersey2/StringUtil.mustache | 0 .../jersey2/allowableValues.mustache | 0 .../{ => libraries}/jersey2/api.mustache | 0 .../jersey2/apiService.mustache | 0 .../jersey2/apiServiceFactory.mustache | 0 .../jersey2/apiServiceImpl.mustache | 0 .../jersey2/bodyParams.mustache | 0 .../jersey2/bootstrap.mustache | 0 .../jersey2/enumClass.mustache | 2 +- .../jersey2/enumOuterClass.mustache | 0 .../jersey2/formParams.mustache | 0 .../jersey2/generatedAnnotation.mustache | 0 .../jersey2/headerParams.mustache | 0 .../jersey2/jacksonJsonProvider.mustache | 0 .../jersey2}/model.mustache | 0 .../jersey2/pathParams.mustache | 0 .../{ => libraries}/jersey2/pojo.mustache | 0 .../{ => libraries}/jersey2/pom.mustache | 13 +- .../jersey2/project/build.properties | 0 .../jersey2/project/plugins.sbt | 0 .../jersey2/queryParams.mustache | 0 .../jersey2/returnTypes.mustache | 0 .../jersey2/serviceBodyParams.mustache | 0 .../jersey2/serviceFormParams.mustache | 0 .../jersey2/serviceHeaderParams.mustache | 0 .../jersey2/servicePathParams.mustache | 0 .../jersey2/serviceQueryParams.mustache | 0 .../{ => libraries}/jersey2/web.mustache | 0 .../java/jaxrs/AllowableValuesTest.java | 2 +- .../codegen/jaxrs/JaxRSServerOptionsTest.java | 3 +- .../options/JaxRSServerOptionsProvider.java | 45 +++- pom.xml | 17 +- .../jaxrs/jersey1/.swagger-codegen-ignore | 23 ++ samples/server/petstore/jaxrs/jersey1/LICENSE | 201 ++++++++++++++++ .../petstore/jaxrs/{ => jersey1}/README.md | 0 .../petstore/jaxrs/{ => jersey1}/pom.xml | 15 +- .../gen/java/io/swagger/api/ApiException.java | 0 .../java/io/swagger/api/ApiOriginFilter.java | 0 .../io/swagger/api/ApiResponseMessage.java | 0 .../io/swagger/api/JacksonJsonProvider.java | 0 .../io/swagger/api/NotFoundException.java | 0 .../src/gen/java/io/swagger/api/PetApi.java | 0 .../java/io/swagger/api/PetApiService.java | 0 .../src/gen/java/io/swagger/api/StoreApi.java | 0 .../java/io/swagger/api/StoreApiService.java | 0 .../gen/java/io/swagger/api/StringUtil.java | 0 .../src/gen/java/io/swagger/api/UserApi.java | 0 .../java/io/swagger/api/UserApiService.java | 0 .../gen/java/io/swagger/model/Category.java | 94 ++++++++ .../io/swagger/model/ModelApiResponse.java} | 19 +- .../src/gen/java/io/swagger/model/Order.java | 0 .../src/gen/java/io/swagger/model/Pet.java | 0 .../src/gen/java/io/swagger/model/Tag.java | 94 ++++++++ .../src/gen/java/io/swagger/model/User.java | 215 ++++++++++++++++++ .../main/java/io/swagger/api/Bootstrap.java | 0 .../api/factories/PetApiServiceFactory.java | 2 +- .../api/factories/StoreApiServiceFactory.java | 2 +- .../api/factories/UserApiServiceFactory.java | 2 +- .../swagger/api/impl/PetApiServiceImpl.java | 13 +- .../swagger/api/impl/StoreApiServiceImpl.java | 7 +- .../swagger/api/impl/UserApiServiceImpl.java | 11 +- .../src/main/webapp/WEB-INF/web.xml | 0 .../jaxrs/jersey2/.swagger-codegen-ignore | 23 ++ samples/server/petstore/jaxrs/jersey2/LICENSE | 201 ++++++++++++++++ .../server/petstore/jaxrs/jersey2/README.md | 23 ++ samples/server/petstore/jaxrs/jersey2/pom.xml | 146 ++++++++++++ .../gen/java/io/swagger/api/ApiException.java | 10 + .../java/io/swagger/api/ApiOriginFilter.java | 22 ++ .../io/swagger/api/ApiResponseMessage.java | 69 ++++++ .../io/swagger/api/JacksonJsonProvider.java | 19 ++ .../io/swagger/api/NotFoundException.java | 10 + .../src/gen/java/io/swagger/api/PetApi.java | 173 ++++++++++++++ .../java/io/swagger/api/PetApiService.java | 30 +++ .../src/gen/java/io/swagger/api/StoreApi.java | 87 +++++++ .../java/io/swagger/api/StoreApiService.java | 25 ++ .../gen/java/io/swagger/api/StringUtil.java | 42 ++++ .../src/gen/java/io/swagger/api/UserApi.java | 131 +++++++++++ .../java/io/swagger/api/UserApiService.java | 29 +++ .../gen/java/io/swagger/model/Category.java | 0 .../io/swagger/model/ModelApiResponse.java | 0 .../src/gen/java/io/swagger/model/Order.java | 196 ++++++++++++++++ .../src/gen/java/io/swagger/model/Pet.java | 199 ++++++++++++++++ .../src/gen/java/io/swagger/model/Tag.java | 0 .../src/gen/java/io/swagger/model/User.java | 0 .../main/java/io/swagger/api/Bootstrap.java | 31 +++ .../api/factories/PetApiServiceFactory.java | 13 ++ .../api/factories/StoreApiServiceFactory.java | 13 ++ .../api/factories/UserApiServiceFactory.java | 13 ++ .../swagger/api/impl/PetApiServiceImpl.java | 62 +++++ .../swagger/api/impl/StoreApiServiceImpl.java | 41 ++++ .../swagger/api/impl/UserApiServiceImpl.java | 61 +++++ .../jersey2/src/main/webapp/WEB-INF/web.xml | 63 +++++ 142 files changed, 2520 insertions(+), 113 deletions(-) create mode 100755 bin/jaxrs-jersey1-petstore-server.sh rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/ApiException.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/ApiOriginFilter.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/ApiResponseMessage.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/JodaDateTimeProvider.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/JodaLocalDateProvider.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/LocalDateProvider.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/LocalDateTimeProvider.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/NotFoundException.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/README.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/StringUtil.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/allowableValues.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/api.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/apiService.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/apiServiceFactory.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/apiServiceImpl.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/bodyParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/bootstrap.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/enumClass.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/enumOuterClass.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/formParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/generatedAnnotation.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/headerParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/jacksonJsonProvider.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey2 => libraries/jersey1}/model.mustache (76%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/pathParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/pojo.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/pom.mustache (95%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/project/build.properties (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/project/plugins.sbt (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/queryParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/returnTypes.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/serviceBodyParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/serviceFormParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/serviceHeaderParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/servicePathParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/serviceQueryParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey1}/web.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/ApiException.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/ApiOriginFilter.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/ApiResponseMessage.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/JodaDateTimeProvider.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/JodaLocalDateProvider.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/LocalDateProvider.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/LocalDateTimeProvider.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/NotFoundException.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/README.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/StringUtil.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/allowableValues.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/api.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/apiService.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/apiServiceFactory.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/apiServiceImpl.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/bodyParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/bootstrap.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/enumClass.mustache (80%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/enumOuterClass.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/formParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/generatedAnnotation.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/headerParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/jacksonJsonProvider.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{jersey1_18 => libraries/jersey2}/model.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/pathParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/pojo.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/pom.mustache (93%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/project/build.properties (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/project/plugins.sbt (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/queryParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/returnTypes.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/serviceBodyParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/serviceFormParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/serviceHeaderParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/servicePathParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/serviceQueryParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/JavaJaxRS/{ => libraries}/jersey2/web.mustache (100%) create mode 100644 samples/server/petstore/jaxrs/jersey1/.swagger-codegen-ignore create mode 100644 samples/server/petstore/jaxrs/jersey1/LICENSE rename samples/server/petstore/jaxrs/{ => jersey1}/README.md (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/pom.xml (93%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/ApiException.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/ApiOriginFilter.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/ApiResponseMessage.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/JacksonJsonProvider.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/NotFoundException.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/PetApi.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/PetApiService.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/StoreApi.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/StoreApiService.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/StringUtil.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/UserApi.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/api/UserApiService.java (100%) create mode 100644 samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Category.java rename samples/server/petstore/jaxrs/{src/gen/java/io/swagger/model/ApiResponse.java => jersey1/src/gen/java/io/swagger/model/ModelApiResponse.java} (79%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/model/Order.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/gen/java/io/swagger/model/Pet.java (100%) create mode 100644 samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Tag.java create mode 100644 samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/User.java rename samples/server/petstore/jaxrs/{ => jersey1}/src/main/java/io/swagger/api/Bootstrap.java (100%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java (68%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java (69%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java (69%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java (92%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java (90%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java (93%) rename samples/server/petstore/jaxrs/{ => jersey1}/src/main/webapp/WEB-INF/web.xml (100%) create mode 100644 samples/server/petstore/jaxrs/jersey2/.swagger-codegen-ignore create mode 100644 samples/server/petstore/jaxrs/jersey2/LICENSE create mode 100644 samples/server/petstore/jaxrs/jersey2/README.md create mode 100644 samples/server/petstore/jaxrs/jersey2/pom.xml create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiException.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiOriginFilter.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiResponseMessage.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/JacksonJsonProvider.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/NotFoundException.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/PetApi.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/PetApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StoreApi.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StoreApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StringUtil.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/UserApi.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/UserApiService.java rename samples/server/petstore/jaxrs/{ => jersey2}/src/gen/java/io/swagger/model/Category.java (100%) rename samples/server/petstore/jaxrs/{ => jersey2}/src/gen/java/io/swagger/model/ModelApiResponse.java (100%) create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Order.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Pet.java rename samples/server/petstore/jaxrs/{ => jersey2}/src/gen/java/io/swagger/model/Tag.java (100%) rename samples/server/petstore/jaxrs/{ => jersey2}/src/gen/java/io/swagger/model/User.java (100%) create mode 100644 samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/Bootstrap.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/main/webapp/WEB-INF/web.xml diff --git a/bin/jaxrs-jersey1-petstore-server.sh b/bin/jaxrs-jersey1-petstore-server.sh new file mode 100755 index 000000000000..8195b02c72b5 --- /dev/null +++ b/bin/jaxrs-jersey1-petstore-server.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jaxrs/jersey1 -DhideGenerationTimestamp=true --library=jersey1 --artifact-id=swagger-jaxrs-jersey1-server" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-petstore-server.sh b/bin/jaxrs-petstore-server.sh index 6436c797e879..3c7e4af91a8a 100755 --- a/bin/jaxrs-petstore-server.sh +++ b/bin/jaxrs-petstore-server.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jaxrs -DhideGenerationTimestamp=true" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jaxrs/jersey2 -DhideGenerationTimestamp=true" java $JAVA_OPTS -jar $executable $ags 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 c09b4ac3019c..27f435250a0c 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 @@ -8,10 +8,12 @@ import io.swagger.models.Operation; import io.swagger.models.Path; import io.swagger.models.Swagger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.*; -public abstract class AbstractJavaJAXRSServerCodegen extends JavaClientCodegen -{ +public abstract class AbstractJavaJAXRSServerCodegen extends JavaClientCodegen { /** * Name of the sub-directory in "src/main/resource" where to find the * Mustache template for the JAX-RS Codegen. @@ -19,6 +21,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends JavaClientCodegen protected static final String JAXRS_TEMPLATE_DIRECTORY_NAME = "JavaJaxRS"; protected String implFolder = "src/main/java"; protected String title = "Swagger Server"; + static Logger LOGGER = LoggerFactory.getLogger(AbstractJavaJAXRSServerCodegen.class); public AbstractJavaJAXRSServerCodegen() { @@ -199,4 +202,5 @@ public abstract class AbstractJavaJAXRSServerCodegen extends JavaClientCodegen public boolean shouldOverwrite(String filename) { return super.shouldOverwrite(filename) && !filename.endsWith("ServiceImpl.java") && !filename.endsWith("ServiceFactory.java"); } + } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java index 52f3eb8d844a..72f969403bf5 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java @@ -6,6 +6,8 @@ import io.swagger.models.Operation; import java.io.File; import java.util.*; +import org.apache.commons.lang3.StringUtils; + public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { public JavaJerseyServerCodegen() { super(); @@ -26,7 +28,7 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { additionalProperties.put("title", title); - embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "jersey1_18"; + embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME; for ( int i = 0; i < cliOptions.size(); i++ ) { if ( CodegenConstants.LIBRARY.equals(cliOptions.get(i).getOpt()) ) { @@ -36,13 +38,11 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { } CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); - library.setDefault(DEFAULT_LIBRARY); - Map supportedLibraries = new LinkedHashMap(); - - supportedLibraries.put(DEFAULT_LIBRARY, "Jersey core 1.18.1"); - supportedLibraries.put("jersey2", "Jersey core 2.x"); + supportedLibraries.put("jersey1", "Jersey core 1.x"); + supportedLibraries.put("jersey2", "Jersey core 2.x (default)"); library.setEnum(supportedLibraries); + library.setDefault("jersey1"); cliOptions.add(library); cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC)); @@ -73,16 +73,35 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { public void processOpts() { super.processOpts(); + // set jersey2 as default + if (StringUtils.isEmpty(library)) { + setLibrary("jersey2"); + } + + supportingFiles.clear(); + // clear model and api doc template as this codegen // does not support auto-generated markdown doc at the moment modelDocTemplateFiles.remove("model_doc.mustache"); apiDocTemplateFiles.remove("api_doc.mustache"); - if ( additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER) ) { + if ( additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER)) { implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER); } - supportingFiles.clear(); + if (additionalProperties.containsKey("dateLibrary")) { + setDateLibrary(additionalProperties.get("dateLibrary").toString()); + additionalProperties.put(dateLibrary, "true"); + } + + if ("joda".equals(dateLibrary)) { + supportingFiles.add(new SupportingFile("JodaDateTimeProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaDateTimeProvider.java")); + supportingFiles.add(new SupportingFile("JodaLocalDateProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaLocalDateProvider.java")); + } else if ( "java8".equals(dateLibrary) ) { + supportingFiles.add(new SupportingFile("LocalDateTimeProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "LocalDateTimeProvider.java")); + supportingFiles.add(new SupportingFile("LocalDateProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "LocalDateProvider.java")); + } + writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml")); writeOptional(outputFolder, new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("ApiException.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiException.java")); @@ -91,40 +110,8 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { supportingFiles.add(new SupportingFile("NotFoundException.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "NotFoundException.java")); supportingFiles.add(new SupportingFile("jacksonJsonProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JacksonJsonProvider.java")); writeOptional(outputFolder, new SupportingFile("bootstrap.mustache", (implFolder + '/' + apiPackage).replace(".", "/"), "Bootstrap.java")); - writeOptional(outputFolder, new SupportingFile("web.mustache", ("src/main/webapp/WEB-INF"), "web.xml")); supportingFiles.add(new SupportingFile("StringUtil.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "StringUtil.java")); - - if ( additionalProperties.containsKey("dateLibrary") ) { - setDateLibrary(additionalProperties.get("dateLibrary").toString()); - additionalProperties.put(dateLibrary, "true"); - } - if(DEFAULT_LIBRARY.equals(library) || library == null) { - if(templateDir.startsWith(JAXRS_TEMPLATE_DIRECTORY_NAME)) { - // set to the default location - templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "jersey1_18"; - } - else { - templateDir += File.separator + "jersey1_18"; - } - } - if("jersey2".equals(library)) { - if(templateDir.startsWith(JAXRS_TEMPLATE_DIRECTORY_NAME)) { - // set to the default location - templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "jersey2"; - } - else { - templateDir += File.separator + "jersey2"; - } - } - - if ( "joda".equals(dateLibrary) ) { - supportingFiles.add(new SupportingFile("JodaDateTimeProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaDateTimeProvider.java")); - supportingFiles.add(new SupportingFile("JodaLocalDateProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaLocalDateProvider.java")); - } else if ( "java8".equals(dateLibrary) ) { - supportingFiles.add(new SupportingFile("LocalDateTimeProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "LocalDateTimeProvider.java")); - supportingFiles.add(new SupportingFile("LocalDateProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "LocalDateProvider.java")); - } } @Override diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/ApiException.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/ApiException.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/ApiException.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/ApiException.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/ApiOriginFilter.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/ApiOriginFilter.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/ApiOriginFilter.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/ApiOriginFilter.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/ApiResponseMessage.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/ApiResponseMessage.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/ApiResponseMessage.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/ApiResponseMessage.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/JodaDateTimeProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/JodaDateTimeProvider.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/JodaDateTimeProvider.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/JodaDateTimeProvider.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/JodaLocalDateProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/JodaLocalDateProvider.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/JodaLocalDateProvider.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/JodaLocalDateProvider.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/LocalDateProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/LocalDateProvider.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/LocalDateProvider.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/LocalDateProvider.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/LocalDateTimeProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/LocalDateTimeProvider.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/LocalDateTimeProvider.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/LocalDateTimeProvider.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/NotFoundException.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/NotFoundException.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/NotFoundException.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/NotFoundException.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/README.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/README.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/README.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/README.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/StringUtil.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/StringUtil.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/StringUtil.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/StringUtil.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/allowableValues.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/allowableValues.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/allowableValues.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/allowableValues.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/api.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/api.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/api.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/api.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/apiService.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/apiService.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/apiService.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/apiService.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/apiServiceFactory.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/apiServiceFactory.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/apiServiceFactory.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/apiServiceFactory.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/apiServiceImpl.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/apiServiceImpl.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/apiServiceImpl.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/apiServiceImpl.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/bodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/bodyParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/bodyParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/bodyParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/bootstrap.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/bootstrap.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/bootstrap.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/bootstrap.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/enumClass.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/enumClass.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/enumClass.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/enumOuterClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/enumOuterClass.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/enumOuterClass.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/enumOuterClass.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/formParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/formParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/formParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/formParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/generatedAnnotation.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/generatedAnnotation.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/generatedAnnotation.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/headerParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/headerParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/headerParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/headerParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/jacksonJsonProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/jacksonJsonProvider.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/jacksonJsonProvider.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/jacksonJsonProvider.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/model.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/model.mustache similarity index 76% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/model.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/model.mustache index b9512d2b83cb..738fe1c1440e 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/model.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/model.mustache @@ -1,6 +1,8 @@ package {{package}}; import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; {{#imports}}import {{import}}; {{/imports}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/pathParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pathParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/pathParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/pojo.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pojo.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/pojo.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/pom.mustache similarity index 95% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pom.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/pom.mustache index 180450ce73f2..96e657cac2b3 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/pom.mustache @@ -168,11 +168,12 @@ - 1.5.8 + 1.5.9 9.2.9.v20150224 - 1.18.1 - 1.6.3 - 4.8.1 + 1.19.1 + 1.7.21 + 4.12 2.5 + UTF-8 - \ No newline at end of file + diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/project/build.properties b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/project/build.properties similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/project/build.properties rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/project/build.properties diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/project/plugins.sbt b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/project/plugins.sbt similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/project/plugins.sbt rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/project/plugins.sbt diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/queryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/queryParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/queryParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/queryParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/returnTypes.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/returnTypes.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/returnTypes.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/returnTypes.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/serviceBodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/serviceBodyParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/serviceBodyParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/serviceBodyParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/serviceFormParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/serviceFormParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/serviceFormParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/serviceFormParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/serviceHeaderParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/serviceHeaderParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/serviceHeaderParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/serviceHeaderParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/servicePathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/servicePathParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/servicePathParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/servicePathParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/serviceQueryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/serviceQueryParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/serviceQueryParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/serviceQueryParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/web.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/web.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/web.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/web.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/ApiException.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/ApiException.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/ApiException.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/ApiException.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/ApiOriginFilter.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/ApiOriginFilter.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/ApiOriginFilter.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/ApiOriginFilter.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/ApiResponseMessage.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/ApiResponseMessage.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/ApiResponseMessage.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/ApiResponseMessage.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/JodaDateTimeProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/JodaDateTimeProvider.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/JodaDateTimeProvider.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/JodaDateTimeProvider.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/JodaLocalDateProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/JodaLocalDateProvider.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/JodaLocalDateProvider.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/JodaLocalDateProvider.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/LocalDateProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/LocalDateProvider.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/LocalDateProvider.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/LocalDateProvider.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/LocalDateTimeProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/LocalDateTimeProvider.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/LocalDateTimeProvider.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/LocalDateTimeProvider.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/NotFoundException.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/NotFoundException.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/NotFoundException.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/NotFoundException.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/README.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/README.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/README.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/README.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/StringUtil.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/StringUtil.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/StringUtil.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/StringUtil.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/allowableValues.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/allowableValues.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/allowableValues.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/allowableValues.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/api.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/api.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/api.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/api.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/apiService.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/apiService.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/apiService.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/apiService.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/apiServiceFactory.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/apiServiceFactory.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/apiServiceFactory.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/apiServiceFactory.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/apiServiceImpl.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/apiServiceImpl.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/apiServiceImpl.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/apiServiceImpl.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/bodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/bodyParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/bodyParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/bodyParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/bootstrap.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/bootstrap.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/bootstrap.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/bootstrap.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/enumClass.mustache similarity index 80% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/enumClass.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/enumClass.mustache index 6010e26704f5..0867107d9930 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/enumClass.mustache @@ -1,6 +1,6 @@ public enum {{{datatypeWithEnum}}} { - {{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}}, + {{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} private String value; diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/enumOuterClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/enumOuterClass.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/enumOuterClass.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/enumOuterClass.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/formParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/formParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/formParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/formParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/generatedAnnotation.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/generatedAnnotation.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/generatedAnnotation.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/headerParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/headerParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/headerParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/headerParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/jacksonJsonProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/jacksonJsonProvider.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/jacksonJsonProvider.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/jacksonJsonProvider.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/model.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/model.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey1_18/model.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/model.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/pathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/pathParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/pathParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/pathParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/pojo.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/pojo.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/pojo.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/pom.mustache similarity index 93% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/pom.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/pom.mustache index a2f59b53fe7c..d69ff1632ec1 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/pom.mustache @@ -134,12 +134,13 @@ - 1.5.8 + 1.5.9 9.2.9.v20150224 - 2.6 - 1.6.3 - 4.8.1 - 1.0.1 + 2.22.2 + 1.7.21 + 4.12 + 1.1.7 2.5 + UTF-8 - \ No newline at end of file + diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/project/build.properties b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/project/build.properties similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/project/build.properties rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/project/build.properties diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/project/plugins.sbt b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/project/plugins.sbt similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/project/plugins.sbt rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/project/plugins.sbt diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/queryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/queryParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/queryParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/queryParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/returnTypes.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/returnTypes.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/returnTypes.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/returnTypes.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/serviceBodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/serviceBodyParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/serviceBodyParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/serviceBodyParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/serviceFormParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/serviceFormParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/serviceFormParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/serviceFormParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/serviceHeaderParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/serviceHeaderParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/serviceHeaderParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/serviceHeaderParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/servicePathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/servicePathParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/servicePathParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/servicePathParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/serviceQueryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/serviceQueryParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/serviceQueryParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/serviceQueryParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/web.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/web.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaJaxRS/jersey2/web.mustache rename to modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey2/web.mustache diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/jaxrs/AllowableValuesTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/jaxrs/AllowableValuesTest.java index 4a4e6ff91802..6080860735f3 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/jaxrs/AllowableValuesTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/jaxrs/AllowableValuesTest.java @@ -17,7 +17,7 @@ import java.nio.charset.StandardCharsets; public class AllowableValuesTest { - private static final String TEMPLATE_FILE = "JavaJaxRS/jersey1_18/allowableValues.mustache"; + private static final String TEMPLATE_FILE = "JavaJaxRS/libraries/jersey1/allowableValues.mustache"; private static final String PROVIDER_NAME = "operations"; private static String loadClassResource(Class cls, String name) throws IOException { diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxRSServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxRSServerOptionsTest.java index ddc8f2af06fa..51dcd5fc90d7 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxRSServerOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxRSServerOptionsTest.java @@ -46,7 +46,8 @@ public class JaxRSServerOptionsTest extends JavaClientOptionsTest { times = 1; clientCodegen.setSerializableModel(Boolean.valueOf(JaxRSServerOptionsProvider.SERIALIZABLE_MODEL_VALUE)); times = 1; - clientCodegen.setLibrary(JaxRSServerOptionsProvider.DEFAULT_LIBRARY_VALUE); + //clientCodegen.setLibrary(JaxRSServerOptionsProvider.JAXRS_LIBRARY_VALUE); + clientCodegen.setLibrary("jersey1"); times = 1; clientCodegen.setFullJavaUtil(Boolean.valueOf(JaxRSServerOptionsProvider.FULL_JAVA_UTIL_VALUE)); times = 1; diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JaxRSServerOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JaxRSServerOptionsProvider.java index f2735614f193..3006ed396c95 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JaxRSServerOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JaxRSServerOptionsProvider.java @@ -2,12 +2,27 @@ package io.swagger.codegen.options; import com.google.common.collect.ImmutableMap; import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.languages.JavaClientCodegen; import java.util.Map; -public class JaxRSServerOptionsProvider extends JavaOptionsProvider { +public class JaxRSServerOptionsProvider implements OptionsProvider { + public static final String ARTIFACT_ID_VALUE = "swagger-java-client-test"; + public static final String MODEL_PACKAGE_VALUE = "package"; + public static final String API_PACKAGE_VALUE = "apiPackage"; + public static final String INVOKER_PACKAGE_VALUE = "io.swagger.client.test"; + public static final String SORT_PARAMS_VALUE = "false"; + public static final String GROUP_ID_VALUE = "io.swagger.test"; + public static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT"; + public static final String SOURCE_FOLDER_VALUE = "src/main/java/test"; + public static final String LOCAL_PREFIX_VALUE = "tst"; + public static final String DEFAULT_LIBRARY_VALUE = "jersey2"; + public static final String SERIALIZABLE_MODEL_VALUE = "false"; + public static final String FULL_JAVA_UTIL_VALUE = "true"; + public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final String JODA_DATE_LIBRARY = "joda"; - public static final String IMPL_FOLDER_VALUE = "src/main/java/impl"; + public static final String IMPL_FOLDER_VALUE = "src/main/java/impl"; + public static final String JAXRS_DEFAULT_LIBRARY_VALUE = "jersey1"; @Override public boolean isServer() { @@ -21,13 +36,27 @@ public class JaxRSServerOptionsProvider extends JavaOptionsProvider { @Override public Map createOptions() { - Map options = super.createOptions(); - ImmutableMap.Builder builder = new ImmutableMap.Builder(); - builder.putAll(options) - .put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE) - //.put(JavaJaxRSJersey1ServerCodegen.DATE_LIBRARY, "joda") //java.lang.IllegalArgumentException: Multiple entries with same key: dateLibrary=joda and dateLibrary=joda - .put("title", "Test title"); + builder.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE) + .put(JavaClientCodegen.DATE_LIBRARY, "joda") //java.lang.IllegalArgumentException: Multiple entries with same key: dateLibrary=joda and dateLibrary=joda + .put("title", "Test title") + .put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE) + .put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE) + .put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) + .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) + .put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE) + .put(CodegenConstants.GROUP_ID, GROUP_ID_VALUE) + .put(CodegenConstants.ARTIFACT_ID, ARTIFACT_ID_VALUE) + .put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE) + .put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE) + .put(CodegenConstants.LOCAL_VARIABLE_PREFIX, LOCAL_PREFIX_VALUE) + .put(CodegenConstants.SERIALIZABLE_MODEL, SERIALIZABLE_MODEL_VALUE) + .put(JavaClientCodegen.FULL_JAVA_UTIL, FULL_JAVA_UTIL_VALUE) + .put(CodegenConstants.LIBRARY, JAXRS_DEFAULT_LIBRARY_VALUE) + .put(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, "true") + .put(JavaClientCodegen.USE_RX_JAVA, "false") + //.put(JavaClientCodegen.DATE_LIBRARY, "joda") + .put("hideGenerationTimestamp", "true"); return builder.build(); } diff --git a/pom.xml b/pom.xml index 2b6c45f8662c..af8c8544e817 100644 --- a/pom.xml +++ b/pom.xml @@ -435,7 +435,19 @@ - samples/server/petstore/jaxrs + samples/server/petstore/jaxrs/jersey2 + + + + jaxrs-server-jersey1 + + + env + java + + + + samples/server/petstore/jaxrs/jersey1 @@ -564,7 +576,8 @@ samples/client/petstore/javascript samples/client/petstore/scala samples/server/petstore/spring-mvc - samples/server/petstore/jaxrs + samples/server/petstore/jaxrs/jersey1 + samples/server/petstore/jaxrs/jersey2 samples/server/petstore/jaxrs-resteasy diff --git a/samples/server/petstore/jaxrs/jersey1/.swagger-codegen-ignore b/samples/server/petstore/jaxrs/jersey1/.swagger-codegen-ignore new file mode 100644 index 000000000000..19d3377182e2 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# 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 Swagger Codgen 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 +# Thsi 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/jaxrs/jersey1/LICENSE b/samples/server/petstore/jaxrs/jersey1/LICENSE new file mode 100644 index 000000000000..8dada3edaf50 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + 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. diff --git a/samples/server/petstore/jaxrs/README.md b/samples/server/petstore/jaxrs/jersey1/README.md similarity index 100% rename from samples/server/petstore/jaxrs/README.md rename to samples/server/petstore/jaxrs/jersey1/README.md diff --git a/samples/server/petstore/jaxrs/pom.xml b/samples/server/petstore/jaxrs/jersey1/pom.xml similarity index 93% rename from samples/server/petstore/jaxrs/pom.xml rename to samples/server/petstore/jaxrs/jersey1/pom.xml index 9064489b34d7..4fb015cf78c8 100644 --- a/samples/server/petstore/jaxrs/pom.xml +++ b/samples/server/petstore/jaxrs/jersey1/pom.xml @@ -1,9 +1,9 @@ 4.0.0 io.swagger - swagger-jaxrs-server + swagger-jaxrs-jersey1-server jar - swagger-jaxrs-server + swagger-jaxrs-jersey1-server 1.0.0 src/main/java @@ -168,11 +168,12 @@ - 1.5.8 + 1.5.9 9.2.9.v20150224 - 1.18.1 - 1.6.3 - 4.8.1 + 1.19.1 + 1.7.21 + 4.12 2.5 + UTF-8 - \ No newline at end of file + diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiException.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/ApiException.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiException.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/ApiException.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/ApiOriginFilter.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiOriginFilter.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/ApiOriginFilter.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/ApiResponseMessage.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiResponseMessage.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/ApiResponseMessage.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/JacksonJsonProvider.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/JacksonJsonProvider.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/JacksonJsonProvider.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/JacksonJsonProvider.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/NotFoundException.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/NotFoundException.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/NotFoundException.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/PetApi.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApi.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/PetApi.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/PetApiService.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApiService.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/PetApiService.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/StoreApi.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApi.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/StoreApi.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApiService.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/StoreApiService.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApiService.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/StoreApiService.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StringUtil.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/StringUtil.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StringUtil.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/StringUtil.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/UserApi.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApi.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/UserApi.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/UserApiService.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApiService.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/UserApiService.java diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Category.java new file mode 100644 index 000000000000..f76411d073a3 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Category.java @@ -0,0 +1,94 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + + + + + +public class Category { + + private Long id = null; + private String name = null; + + /** + **/ + public Category id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Category name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/ApiResponse.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/ModelApiResponse.java similarity index 79% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/ApiResponse.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/ModelApiResponse.java index ac9fb970f82b..9c61a7434e7c 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/ApiResponse.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -2,6 +2,7 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -10,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; -public class ApiResponse { +public class ModelApiResponse { private Integer code = null; private String type = null; @@ -18,7 +19,7 @@ public class ApiResponse { /** **/ - public ApiResponse code(Integer code) { + public ModelApiResponse code(Integer code) { this.code = code; return this; } @@ -35,7 +36,7 @@ public class ApiResponse { /** **/ - public ApiResponse type(String type) { + public ModelApiResponse type(String type) { this.type = type; return this; } @@ -52,7 +53,7 @@ public class ApiResponse { /** **/ - public ApiResponse message(String message) { + public ModelApiResponse message(String message) { this.message = message; return this; } @@ -76,10 +77,10 @@ public class ApiResponse { if (o == null || getClass() != o.getClass()) { return false; } - ApiResponse apiResponse = (ApiResponse) o; - return Objects.equals(code, apiResponse.code) && - Objects.equals(type, apiResponse.type) && - Objects.equals(message, apiResponse.message); + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); } @Override @@ -90,7 +91,7 @@ public class ApiResponse { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class ApiResponse {\n"); + sb.append("class ModelApiResponse {\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Order.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Order.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Pet.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java rename to samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Pet.java diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Tag.java new file mode 100644 index 000000000000..f203b01f55ba --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Tag.java @@ -0,0 +1,94 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + + + + + +public class Tag { + + private Long id = null; + private String name = null; + + /** + **/ + public Tag id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Tag name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/User.java new file mode 100644 index 000000000000..f239bb3febc8 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/User.java @@ -0,0 +1,215 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + + + + + +public class User { + + private Long id = null; + private String username = null; + private String firstName = null; + private String lastName = null; + private String email = null; + private String password = null; + private String phone = null; + private Integer userStatus = null; + + /** + **/ + public User id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public User username(String username) { + this.username = username; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("firstName") + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + **/ + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("lastName") + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + **/ + public User email(String email) { + this.email = email; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("email") + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + + /** + **/ + public User password(String password) { + this.password = password; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("password") + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + + /** + **/ + public User phone(String phone) { + this.phone = phone; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("phone") + public String getPhone() { + return phone; + } + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * User Status + **/ + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + + @ApiModelProperty(value = "User Status") + @JsonProperty("userStatus") + public Integer getUserStatus() { + return userStatus; + } + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/Bootstrap.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/Bootstrap.java similarity index 100% rename from samples/server/petstore/jaxrs/src/main/java/io/swagger/api/Bootstrap.java rename to samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/Bootstrap.java diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java similarity index 68% rename from samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java rename to samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java index 8a15fd9a8ade..54ae4b48435f 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java @@ -3,7 +3,7 @@ package io.swagger.api.factories; import io.swagger.api.PetApiService; import io.swagger.api.impl.PetApiServiceImpl; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00") + public class PetApiServiceFactory { private final static PetApiService service = new PetApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java similarity index 69% rename from samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java rename to samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java index 4f83a413c6f8..79a403fee065 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java @@ -3,7 +3,7 @@ package io.swagger.api.factories; import io.swagger.api.StoreApiService; import io.swagger.api.impl.StoreApiServiceImpl; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00") + public class StoreApiServiceFactory { private final static StoreApiService service = new StoreApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java similarity index 69% rename from samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java rename to samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java index 0ce96e28a306..2f1ae542f1ba 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java @@ -3,7 +3,7 @@ package io.swagger.api.factories; import io.swagger.api.UserApiService; import io.swagger.api.impl.UserApiServiceImpl; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00") + public class UserApiServiceFactory { private final static UserApiService service = new UserApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java similarity index 92% rename from samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java rename to samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java index a61831902126..0dc50dd1fcc8 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java @@ -6,8 +6,8 @@ import io.swagger.model.*; import com.sun.jersey.multipart.FormDataParam; import io.swagger.model.Pet; -import io.swagger.model.ApiResponse; import java.io.File; +import io.swagger.model.ModelApiResponse; import java.util.List; import io.swagger.api.NotFoundException; @@ -20,63 +20,54 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00") + public class PetApiServiceImpl extends PetApiService { - @Override public Response addPet(Pet body, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response deletePet(Long petId, String apiKey, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response findPetsByStatus(List status, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response findPetsByTags(List tags, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response getPetById(Long petId, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response updatePet(Pet body, SecurityContext securityContext) 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, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response uploadFile(Long petId, String additionalMetadata, InputStream inputStream, FormDataContentDisposition fileDetail, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - } diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java similarity index 90% rename from samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java rename to samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java index d347d2b8f1f0..2b00aa8fad0d 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java @@ -19,35 +19,30 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00") + public class StoreApiServiceImpl extends StoreApiService { - @Override public Response deleteOrder(String orderId, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response getInventory(SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response getOrderById(Long orderId, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response placeOrder(Order body, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - } diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java similarity index 93% rename from samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java rename to samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java index 5a73ac74e73d..902658f35a84 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java @@ -19,63 +19,54 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-03T13:30:41.715-06:00") + public class UserApiServiceImpl extends UserApiService { - @Override public Response createUser(User body, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response createUsersWithArrayInput(List body, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response createUsersWithListInput(List body, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response deleteUser(String username, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response getUserByName(String username, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response loginUser(String username, String password, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response logoutUser(SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - @Override public Response updateUser(String username, User body, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } - } diff --git a/samples/server/petstore/jaxrs/src/main/webapp/WEB-INF/web.xml b/samples/server/petstore/jaxrs/jersey1/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from samples/server/petstore/jaxrs/src/main/webapp/WEB-INF/web.xml rename to samples/server/petstore/jaxrs/jersey1/src/main/webapp/WEB-INF/web.xml diff --git a/samples/server/petstore/jaxrs/jersey2/.swagger-codegen-ignore b/samples/server/petstore/jaxrs/jersey2/.swagger-codegen-ignore new file mode 100644 index 000000000000..19d3377182e2 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# 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 Swagger Codgen 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 +# Thsi 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/jaxrs/jersey2/LICENSE b/samples/server/petstore/jaxrs/jersey2/LICENSE new file mode 100644 index 000000000000..8dada3edaf50 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + 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. diff --git a/samples/server/petstore/jaxrs/jersey2/README.md b/samples/server/petstore/jaxrs/jersey2/README.md new file mode 100644 index 000000000000..4e7da8b7f63b --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/README.md @@ -0,0 +1,23 @@ +# Swagger Jersey 2 generated server + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the +[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This +is an example of building a swagger-enabled JAX-RS server. + +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + +To run the server, please execute the following: + +``` +mvn clean package jetty:run +``` + +You can then view the swagger listing here: + +``` +http://localhost:8080/v2/swagger.json +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! \ No newline at end of file diff --git a/samples/server/petstore/jaxrs/jersey2/pom.xml b/samples/server/petstore/jaxrs/jersey2/pom.xml new file mode 100644 index 000000000000..d1772e4f5e70 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/pom.xml @@ -0,0 +1,146 @@ + + 4.0.0 + io.swagger + swagger-jaxrs-server + jar + swagger-jaxrs-server + 1.0.0 + + src/main/java + + + org.apache.maven.plugins + maven-war-plugin + 2.1.1 + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty-version} + + + / + + target/${project.artifactId}-${project.version} + 8079 + stopit + + 8080 + 60000 + + + + + start-jetty + pre-integration-test + + start + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + io.swagger + swagger-jersey2-jaxrs + compile + ${swagger-core-version} + + + ch.qos.logback + logback-classic + ${logback-version} + compile + + + ch.qos.logback + logback-core + ${logback-version} + compile + + + junit + junit + ${junit-version} + test + + + javax.servlet + servlet-api + ${servlet-api-version} + + + org.glassfish.jersey.containers + jersey-container-servlet-core + ${jersey2-version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey2-version} + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 1.5.9 + 9.2.9.v20150224 + 2.22.2 + 1.7.21 + 4.12 + 1.1.7 + 2.5 + UTF-8 + + diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiException.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiException.java new file mode 100644 index 000000000000..97e535d3c219 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiException.java @@ -0,0 +1,10 @@ +package io.swagger.api; + + +public class ApiException extends Exception{ + private int code; + public ApiException (int code, String msg) { + super(msg); + this.code = code; + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiOriginFilter.java new file mode 100644 index 000000000000..38791eef046a --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiOriginFilter.java @@ -0,0 +1,22 @@ +package io.swagger.api; + +import java.io.IOException; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; + + +public class ApiOriginFilter implements javax.servlet.Filter { + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + public void destroy() {} + + public void init(FilterConfig filterConfig) throws ServletException {} +} \ No newline at end of file diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiResponseMessage.java new file mode 100644 index 000000000000..87db95c10095 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/ApiResponseMessage.java @@ -0,0 +1,69 @@ +package io.swagger.api; + +import javax.xml.bind.annotation.XmlTransient; + +@javax.xml.bind.annotation.XmlRootElement + +public class ApiResponseMessage { + public static final int ERROR = 1; + public static final int WARNING = 2; + public static final int INFO = 3; + public static final int OK = 4; + public static final int TOO_BUSY = 5; + + int code; + String type; + String message; + + public ApiResponseMessage(){} + + public ApiResponseMessage(int code, String message){ + this.code = code; + switch(code){ + case ERROR: + setType("error"); + break; + case WARNING: + setType("warning"); + break; + case INFO: + setType("info"); + break; + case OK: + setType("ok"); + break; + case TOO_BUSY: + setType("too busy"); + break; + default: + setType("unknown"); + break; + } + this.message = message; + } + + @XmlTransient + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/JacksonJsonProvider.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/JacksonJsonProvider.java new file mode 100644 index 000000000000..49792814c5ee --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/JacksonJsonProvider.java @@ -0,0 +1,19 @@ +package io.swagger.api; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; +import io.swagger.util.Json; + +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.ext.Provider; + +@Provider +@Produces({MediaType.APPLICATION_JSON}) +public class JacksonJsonProvider extends JacksonJaxbJsonProvider { + private static ObjectMapper commonMapper = Json.mapper(); + + public JacksonJsonProvider() { + super.setMapper(commonMapper); + } +} \ No newline at end of file diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/NotFoundException.java new file mode 100644 index 000000000000..b28b67ea4b2d --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/NotFoundException.java @@ -0,0 +1,10 @@ +package io.swagger.api; + + +public class NotFoundException extends ApiException { + private int code; + public NotFoundException (int code, String msg) { + super(code, msg); + this.code = code; + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/PetApi.java new file mode 100644 index 000000000000..791d56e9eeb9 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/PetApi.java @@ -0,0 +1,173 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.PetApiService; +import io.swagger.api.factories.PetApiServiceFactory; + +import io.swagger.annotations.ApiParam; + +import io.swagger.model.Pet; +import java.io.File; +import io.swagger.model.ModelApiResponse; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/pet") + + +@io.swagger.annotations.Api(description = "the pet API") + +public class PetApi { + private final PetApiService delegate = PetApiServiceFactory.getPetApi(); + + @POST + + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = void.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 = 405, message = "Invalid input", response = void.class) }) + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.addPet(body,securityContext); + } + @DELETE + @Path("/{petId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = void.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 = 400, message = "Invalid pet value", response = void.class) }) + public Response deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.deletePet(petId,apiKey,securityContext); + } + @GET + @Path("/findByStatus") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", 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 = Pet.class, responseContainer = "List"), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") }) + public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true) @QueryParam("status") List status,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.findPetsByStatus(status,securityContext); + } + @GET + @Path("/findByTags") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", 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 = Pet.class, responseContainer = "List"), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "List") }) + public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.findPetsByTags(tags,securityContext); + } + @GET + @Path("/{petId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { + @io.swagger.annotations.Authorization(value = "api_key") + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + public Response getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathParam("petId") Long petId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getPetById(petId,securityContext); + } + @PUT + + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = void.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 = 400, message = "Invalid ID supplied", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = void.class) }) + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updatePet(body,securityContext); + } + @POST + @Path("/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = void.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 = 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,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updatePetWithForm(petId,name,status,securityContext); + } + @POST + @Path("/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "uploads an image", 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 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, + @FormDataParam("file") InputStream inputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.uploadFile(petId,additionalMetadata,inputStream, fileDetail,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/PetApiService.java new file mode 100644 index 000000000000..e472a575fae3 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/PetApiService.java @@ -0,0 +1,30 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import io.swagger.model.Pet; +import java.io.File; +import io.swagger.model.ModelApiResponse; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public abstract class PetApiService { + public abstract Response addPet(Pet body,SecurityContext securityContext) throws NotFoundException; + public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) throws NotFoundException; + public abstract Response findPetsByStatus(List status,SecurityContext securityContext) throws NotFoundException; + public abstract Response findPetsByTags(List tags,SecurityContext securityContext) throws NotFoundException; + public abstract Response getPetById(Long petId,SecurityContext securityContext) throws NotFoundException; + public abstract Response updatePet(Pet body,SecurityContext securityContext) throws NotFoundException; + public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) throws NotFoundException; + public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream inputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StoreApi.java new file mode 100644 index 000000000000..7319e0465f0f --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StoreApi.java @@ -0,0 +1,87 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.StoreApiService; +import io.swagger.api.factories.StoreApiServiceFactory; + +import io.swagger.annotations.ApiParam; + +import java.util.Map; +import io.swagger.model.Order; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/store") + + +@io.swagger.annotations.Api(description = "the store API") + +public class StoreApi { + private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi(); + + @DELETE + @Path("/order/{orderId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = void.class, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = void.class) }) + public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.deleteOrder(orderId,securityContext); + } + @GET + @Path("/inventory") + + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { + @io.swagger.annotations.Authorization(value = "api_key") + }, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Integer.class, responseContainer = "Map") }) + public Response getInventory(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getInventory(securityContext); + } + @GET + @Path("/order/{orderId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), + + @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) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getOrderById(orderId,securityContext); + } + @POST + @Path("/order") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.placeOrder(body,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StoreApiService.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StoreApiService.java new file mode 100644 index 000000000000..5ef766d6aa70 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StoreApiService.java @@ -0,0 +1,25 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import java.util.Map; +import io.swagger.model.Order; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public abstract class StoreApiService { + public abstract Response deleteOrder(String orderId,SecurityContext securityContext) throws NotFoundException; + public abstract Response getInventory(SecurityContext securityContext) throws NotFoundException; + public abstract Response getOrderById(Long orderId,SecurityContext securityContext) throws NotFoundException; + public abstract Response placeOrder(Order body,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StringUtil.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StringUtil.java new file mode 100644 index 000000000000..6f4a3dadbbf8 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/StringUtil.java @@ -0,0 +1,42 @@ +package io.swagger.api; + + +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) return true; + if (value != null && value.equalsIgnoreCase(str)) return true; + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) return ""; + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/UserApi.java new file mode 100644 index 000000000000..ed3d4e4ead4f --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/UserApi.java @@ -0,0 +1,131 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.UserApiService; +import io.swagger.api.factories.UserApiServiceFactory; + +import io.swagger.annotations.ApiParam; + +import io.swagger.model.User; +import java.util.List; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/user") + + +@io.swagger.annotations.Api(description = "the user API") + +public class UserApi { + private final UserApiService delegate = UserApiServiceFactory.getUserApi(); + + @POST + + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) }) + public Response createUser(@ApiParam(value = "Created user object" ,required=true) User body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createUser(body,securityContext); + } + @POST + @Path("/createWithArray") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) }) + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createUsersWithArrayInput(body,securityContext); + } + @POST + @Path("/createWithList") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) }) + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createUsersWithListInput(body,securityContext); + } + @DELETE + @Path("/{username}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @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 deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathParam("username") String username,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.deleteUser(username,securityContext); + } + @GET + @Path("/{username}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class) }) + public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathParam("username") String username,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getUserByName(username,securityContext); + } + @GET + @Path("/login") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + public Response loginUser(@ApiParam(value = "The user name for login",required=true) @QueryParam("username") String username,@ApiParam(value = "The password for login in clear text",required=true) @QueryParam("password") String password,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.loginUser(username,password,securityContext); + } + @GET + @Path("/logout") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) }) + public Response logoutUser(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.logoutUser(securityContext); + } + @PUT + @Path("/{username}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = void.class) }) + public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) User body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updateUser(username,body,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/UserApiService.java new file mode 100644 index 000000000000..ceff72b6391d --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/UserApiService.java @@ -0,0 +1,29 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import io.swagger.model.User; +import java.util.List; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public abstract class UserApiService { + public abstract Response createUser(User body,SecurityContext securityContext) throws NotFoundException; + public abstract Response createUsersWithArrayInput(List body,SecurityContext securityContext) throws NotFoundException; + public abstract Response createUsersWithListInput(List body,SecurityContext securityContext) throws NotFoundException; + public abstract Response deleteUser(String username,SecurityContext securityContext) throws NotFoundException; + public abstract Response getUserByName(String username,SecurityContext securityContext) throws NotFoundException; + public abstract Response loginUser(String username,String password,SecurityContext securityContext) throws NotFoundException; + public abstract Response logoutUser(SecurityContext securityContext) throws NotFoundException; + public abstract Response updateUser(String username,User body,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Category.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Category.java rename to samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Category.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ModelApiResponse.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/ModelApiResponse.java rename to samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/ModelApiResponse.java 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 new file mode 100644 index 000000000000..825fa282b8b0 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Order.java @@ -0,0 +1,196 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; + + + + + + +public class Order { + + private Long id = null; + private Long petId = null; + private Integer quantity = null; + private Date shipDate = null; + + + public enum StatusEnum { + PLACED("placed"), + APPROVED("approved"), + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + } + + private StatusEnum status = null; + private Boolean complete = false; + + /** + **/ + public Order id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("petId") + public Long getPetId() { + return petId; + } + public void setPetId(Long petId) { + this.petId = petId; + } + + /** + **/ + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("quantity") + public Integer getQuantity() { + return quantity; + } + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + /** + **/ + public Order shipDate(Date shipDate) { + this.shipDate = shipDate; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("shipDate") + public Date getShipDate() { + return shipDate; + } + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + /** + * Order Status + **/ + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + + @ApiModelProperty(value = "Order Status") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + **/ + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("complete") + public Boolean getComplete() { + return complete; + } + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + 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 new file mode 100644 index 000000000000..24092cbee254 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Pet.java @@ -0,0 +1,199 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Category; +import io.swagger.model.Tag; +import java.util.ArrayList; +import java.util.List; + + + + + + +public class Pet { + + private Long id = null; + private Category category = null; + private String name = null; + private List photoUrls = new ArrayList(); + private List tags = new ArrayList(); + + + public enum StatusEnum { + AVAILABLE("available"), + PENDING("pending"), + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + } + + private StatusEnum status = null; + + /** + **/ + public Pet id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Pet category(Category category) { + this.category = category; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("category") + public Category getCategory() { + return category; + } + public void setCategory(Category category) { + this.category = category; + } + + /** + **/ + public Pet name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + **/ + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty("photoUrls") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + /** + **/ + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("tags") + public List getTags() { + return tags; + } + public void setTags(List tags) { + this.tags = tags; + } + + /** + * pet status in the store + **/ + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + + @ApiModelProperty(value = "pet status in the store") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Tag.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Tag.java rename to samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/Tag.java diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/User.java similarity index 100% rename from samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/User.java rename to samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/User.java diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/Bootstrap.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/Bootstrap.java new file mode 100644 index 000000000000..1f60ed6cf4b5 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/Bootstrap.java @@ -0,0 +1,31 @@ +package io.swagger.api; + +import io.swagger.jaxrs.config.SwaggerContextService; +import io.swagger.models.*; + +import io.swagger.models.auth.*; + +import javax.servlet.http.HttpServlet; +import javax.servlet.ServletContext; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; + +public class Bootstrap extends HttpServlet { + @Override + public void init(ServletConfig config) throws ServletException { + Info info = new Info() + .title("Swagger Server") + .description("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.") + .termsOfService("http://swagger.io/terms/") + .contact(new Contact() + .email("apiteam@swagger.io")) + .license(new License() + .name("Apache 2.0") + .url("http://www.apache.org/licenses/LICENSE-2.0.html")); + + ServletContext context = config.getServletContext(); + Swagger swagger = new Swagger().info(info); + + new SwaggerContextService().withServletConfig(config).updateSwagger(swagger); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java new file mode 100644 index 000000000000..43321e8c0e9f --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java @@ -0,0 +1,13 @@ +package io.swagger.api.factories; + +import io.swagger.api.PetApiService; +import io.swagger.api.impl.PetApiServiceImpl; + + +public class PetApiServiceFactory { + private final static PetApiService service = new PetApiServiceImpl(); + + public static PetApiService getPetApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java new file mode 100644 index 000000000000..254fd0a9a7da --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java @@ -0,0 +1,13 @@ +package io.swagger.api.factories; + +import io.swagger.api.StoreApiService; +import io.swagger.api.impl.StoreApiServiceImpl; + + +public class StoreApiServiceFactory { + private final static StoreApiService service = new StoreApiServiceImpl(); + + public static StoreApiService getStoreApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java new file mode 100644 index 000000000000..4c50105bb50f --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java @@ -0,0 +1,13 @@ +package io.swagger.api.factories; + +import io.swagger.api.UserApiService; +import io.swagger.api.impl.UserApiServiceImpl; + + +public class UserApiServiceFactory { + private final static UserApiService service = new UserApiServiceImpl(); + + public static UserApiService getUserApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java new file mode 100644 index 000000000000..9c9b7b6c23b0 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java @@ -0,0 +1,62 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import io.swagger.model.Pet; +import java.io.File; +import io.swagger.model.ModelApiResponse; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public class PetApiServiceImpl extends PetApiService { + @Override + public Response addPet(Pet body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response deletePet(Long petId, String apiKey, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response findPetsByStatus(List status, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response findPetsByTags(List tags, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getPetById(Long petId, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response updatePet(Pet body, SecurityContext securityContext) 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, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response uploadFile(Long petId, String additionalMetadata, InputStream inputStream, FormDataContentDisposition fileDetail, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java new file mode 100644 index 000000000000..85e14b0bbe5b --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java @@ -0,0 +1,41 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import java.util.Map; +import io.swagger.model.Order; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public class StoreApiServiceImpl extends StoreApiService { + @Override + public Response deleteOrder(String orderId, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getInventory(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getOrderById(Long orderId, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response placeOrder(Order body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java new file mode 100644 index 000000000000..67bdeb908f63 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java @@ -0,0 +1,61 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import io.swagger.model.User; +import java.util.List; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public class UserApiServiceImpl extends UserApiService { + @Override + public Response createUser(User body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response createUsersWithArrayInput(List body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response createUsersWithListInput(List body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response deleteUser(String username, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getUserByName(String username, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response loginUser(String username, String password, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response logoutUser(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response updateUser(String username, User body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/webapp/WEB-INF/web.xml b/samples/server/petstore/jaxrs/jersey2/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000000..66837dccab8e --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,63 @@ + + + + + jersey + org.glassfish.jersey.servlet.ServletContainer + + jersey.config.server.provider.packages + + io.swagger.jaxrs.listing, + io.swagger.sample.resource, + io.swagger.api + + + + jersey.config.server.provider.classnames + org.glassfish.jersey.media.multipart.MultiPartFeature + + + jersey.config.server.wadl.disableWadl + true + + 1 + + + + Jersey2Config + io.swagger.jersey.config.JerseyJaxrsConfig + + api.version + 1.0.0 + + + swagger.api.title + Swagger Server + + + swagger.api.basepath + http://petstore.swagger.io/v2 + + + 2 + + + Bootstrap + io.swagger.api.Bootstrap + 2 + + + jersey + /v2/* + + + ApiOriginFilter + io.swagger.api.ApiOriginFilter + + + ApiOriginFilter + /* + + From 91c35509b8099c55d5e4a77b0f448a9d0a445978 Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Thu, 2 Jun 2016 15:51:13 +0900 Subject: [PATCH 4/5] set 'None' to body for request if given body is 'None' ( issue #3020 ) (#3021) --- .../src/main/resources/python/rest.mustache | 5 +- samples/client/petstore/python/LICENSE | 2 +- samples/client/petstore/python/README.md | 14 ++-- .../python/docs/AdditionalPropertiesClass.md | 2 + .../client/petstore/python/docs/ArrayTest.md | 3 + ...dPropertiesAndAdditionalPropertiesClass.md | 1 + .../models/additional_properties_class.py | 54 ++++++++++++- .../swagger_client/models/array_test.py | 80 ++++++++++++++++++- ...perties_and_additional_properties_class.py | 30 ++++++- .../petstore/python/swagger_client/rest.py | 5 +- 10 files changed, 180 insertions(+), 16 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/rest.mustache b/modules/swagger-codegen/src/main/resources/python/rest.mustache index e09090a97948..1a6cf193b6c8 100644 --- a/modules/swagger-codegen/src/main/resources/python/rest.mustache +++ b/modules/swagger-codegen/src/main/resources/python/rest.mustache @@ -122,8 +122,11 @@ class RESTClientObject(object): if query_params: url += '?' + urlencode(query_params) if headers['Content-Type'] == 'application/json': + request_body = None + if body: + request_body = json.dumps(body) r = self.pool_manager.request(method, url, - body=json.dumps(body), + body=request_body, headers=headers) if headers['Content-Type'] == 'application/x-www-form-urlencoded': r = self.pool_manager.request(method, url, diff --git a/samples/client/petstore/python/LICENSE b/samples/client/petstore/python/LICENSE index 9c8f3ea0871e..8dada3edaf50 100644 --- a/samples/client/petstore/python/LICENSE +++ b/samples/client/petstore/python/LICENSE @@ -198,4 +198,4 @@ 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. \ No newline at end of file + limitations under the License. diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 1c037fa92522..274de71c4358 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-26T21:44:18.823+01:00 +- Build date: 2016-06-02T12:44:41.178+09:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -130,12 +130,6 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## petstore_auth - **Type**: OAuth @@ -145,6 +139,12 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Author diff --git a/samples/client/petstore/python/docs/AdditionalPropertiesClass.md b/samples/client/petstore/python/docs/AdditionalPropertiesClass.md index 420ac6efe677..ea12f270f025 100644 --- a/samples/client/petstore/python/docs/AdditionalPropertiesClass.md +++ b/samples/client/petstore/python/docs/AdditionalPropertiesClass.md @@ -3,6 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**map_property** | **dict(str, str)** | | [optional] +**map_of_map_property** | [**dict(str, dict(str, str))**](dict.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/docs/ArrayTest.md b/samples/client/petstore/python/docs/ArrayTest.md index 9dcc2c97264c..6ab0d1378065 100644 --- a/samples/client/petstore/python/docs/ArrayTest.md +++ b/samples/client/petstore/python/docs/ArrayTest.md @@ -3,6 +3,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**array_of_string** | **list[str]** | | [optional] +**array_array_of_integer** | **list[list[int]]** | | [optional] +**array_array_of_model** | **list[list[ReadOnlyFirst]]** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 1f8d83427a2c..b9808d5275e5 100644 --- a/samples/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **uuid** | **str** | | [optional] **date_time** | **datetime** | | [optional] +**map** | [**dict(str, Animal)**](Animal.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/swagger_client/models/additional_properties_class.py b/samples/client/petstore/python/swagger_client/models/additional_properties_class.py index ed19d7536aee..c62cc80cd8a2 100644 --- a/samples/client/petstore/python/swagger_client/models/additional_properties_class.py +++ b/samples/client/petstore/python/swagger_client/models/additional_properties_class.py @@ -42,13 +42,63 @@ class AdditionalPropertiesClass(object): and the value is json key in definition. """ self.swagger_types = { - + 'map_property': 'dict(str, str)', + 'map_of_map_property': 'dict(str, dict(str, str))' } self.attribute_map = { - + 'map_property': 'map_property', + 'map_of_map_property': 'map_of_map_property' } + self._map_property = None + self._map_of_map_property = None + + @property + def map_property(self): + """ + Gets the map_property of this AdditionalPropertiesClass. + + + :return: The map_property of this AdditionalPropertiesClass. + :rtype: dict(str, str) + """ + return self._map_property + + @map_property.setter + def map_property(self, map_property): + """ + Sets the map_property of this AdditionalPropertiesClass. + + + :param map_property: The map_property of this AdditionalPropertiesClass. + :type: dict(str, str) + """ + + self._map_property = map_property + + @property + def map_of_map_property(self): + """ + Gets the map_of_map_property of this AdditionalPropertiesClass. + + + :return: The map_of_map_property of this AdditionalPropertiesClass. + :rtype: dict(str, dict(str, str)) + """ + return self._map_of_map_property + + @map_of_map_property.setter + def map_of_map_property(self, map_of_map_property): + """ + Sets the map_of_map_property of this AdditionalPropertiesClass. + + + :param map_of_map_property: The map_of_map_property of this AdditionalPropertiesClass. + :type: dict(str, dict(str, str)) + """ + + self._map_of_map_property = map_of_map_property def to_dict(self): """ diff --git a/samples/client/petstore/python/swagger_client/models/array_test.py b/samples/client/petstore/python/swagger_client/models/array_test.py index ab340f1d1305..def23e7cd5e4 100644 --- a/samples/client/petstore/python/swagger_client/models/array_test.py +++ b/samples/client/petstore/python/swagger_client/models/array_test.py @@ -42,13 +42,89 @@ class ArrayTest(object): and the value is json key in definition. """ self.swagger_types = { - + 'array_of_string': 'list[str]', + 'array_array_of_integer': 'list[list[int]]', + 'array_array_of_model': 'list[list[ReadOnlyFirst]]' } self.attribute_map = { - + 'array_of_string': 'array_of_string', + 'array_array_of_integer': 'array_array_of_integer', + 'array_array_of_model': 'array_array_of_model' } + self._array_of_string = None + self._array_array_of_integer = None + self._array_array_of_model = None + + @property + def array_of_string(self): + """ + Gets the array_of_string of this ArrayTest. + + + :return: The array_of_string of this ArrayTest. + :rtype: list[str] + """ + return self._array_of_string + + @array_of_string.setter + def array_of_string(self, array_of_string): + """ + Sets the array_of_string of this ArrayTest. + + + :param array_of_string: The array_of_string of this ArrayTest. + :type: list[str] + """ + + self._array_of_string = array_of_string + + @property + def array_array_of_integer(self): + """ + Gets the array_array_of_integer of this ArrayTest. + + + :return: The array_array_of_integer of this ArrayTest. + :rtype: list[list[int]] + """ + return self._array_array_of_integer + + @array_array_of_integer.setter + def array_array_of_integer(self, array_array_of_integer): + """ + Sets the array_array_of_integer of this ArrayTest. + + + :param array_array_of_integer: The array_array_of_integer of this ArrayTest. + :type: list[list[int]] + """ + + self._array_array_of_integer = array_array_of_integer + + @property + def array_array_of_model(self): + """ + Gets the array_array_of_model of this ArrayTest. + + + :return: The array_array_of_model of this ArrayTest. + :rtype: list[list[ReadOnlyFirst]] + """ + return self._array_array_of_model + + @array_array_of_model.setter + def array_array_of_model(self, array_array_of_model): + """ + Sets the array_array_of_model of this ArrayTest. + + + :param array_array_of_model: The array_array_of_model of this ArrayTest. + :type: list[list[ReadOnlyFirst]] + """ + + self._array_array_of_model = array_array_of_model def to_dict(self): """ diff --git a/samples/client/petstore/python/swagger_client/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python/swagger_client/models/mixed_properties_and_additional_properties_class.py index 90b9dcc7d795..2122cabdb530 100644 --- a/samples/client/petstore/python/swagger_client/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python/swagger_client/models/mixed_properties_and_additional_properties_class.py @@ -43,16 +43,19 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): """ self.swagger_types = { 'uuid': 'str', - 'date_time': 'datetime' + 'date_time': 'datetime', + 'map': 'dict(str, Animal)' } self.attribute_map = { 'uuid': 'uuid', - 'date_time': 'dateTime' + 'date_time': 'dateTime', + 'map': 'map' } self._uuid = None self._date_time = None + self._map = None @property def uuid(self): @@ -100,6 +103,29 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): self._date_time = date_time + @property + def map(self): + """ + Gets the map of this MixedPropertiesAndAdditionalPropertiesClass. + + + :return: The map of this MixedPropertiesAndAdditionalPropertiesClass. + :rtype: dict(str, Animal) + """ + return self._map + + @map.setter + def map(self, map): + """ + Sets the map of this MixedPropertiesAndAdditionalPropertiesClass. + + + :param map: The map of this MixedPropertiesAndAdditionalPropertiesClass. + :type: dict(str, Animal) + """ + + self._map = map + def to_dict(self): """ Returns the model properties as a dict diff --git a/samples/client/petstore/python/swagger_client/rest.py b/samples/client/petstore/python/swagger_client/rest.py index 96c3b6dabccd..de53bcacdb1f 100644 --- a/samples/client/petstore/python/swagger_client/rest.py +++ b/samples/client/petstore/python/swagger_client/rest.py @@ -142,8 +142,11 @@ class RESTClientObject(object): if query_params: url += '?' + urlencode(query_params) if headers['Content-Type'] == 'application/json': + request_body = None + if body: + request_body = json.dumps(body) r = self.pool_manager.request(method, url, - body=json.dumps(body), + body=request_body, headers=headers) if headers['Content-Type'] == 'application/x-www-form-urlencoded': r = self.pool_manager.request(method, url, From a3610f1c12e5d7912cf2e9f16dff2152ef40291b Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 2 Jun 2016 17:37:11 +0800 Subject: [PATCH 5/5] [Java] fix warning in pom.xml (java okhttp-gson) (#3023) * fix warning in pom.xml * minor fix to pom (okhttp-gson) --- .../Java/libraries/okhttp-gson/pom.mustache | 18 ++++++++++++++++-- .../client/petstore/java/okhttp-gson/pom.xml | 13 +++---------- .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- 8 files changed, 25 insertions(+), 18 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index 7f08e5afb58c..cfe169c5eca8 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -68,6 +68,7 @@ org.codehaus.mojo build-helper-maven-plugin + 1.10 add_sources @@ -104,7 +105,7 @@ 1.7 - + org.codehaus.mojo exec-maven-plugin @@ -123,9 +124,21 @@ + + sbt-test + integration-test + + exec + + + sbt + + publishLocal + + + - @@ -164,5 +177,6 @@ 2.6.2 1.0.0 4.12 + UTF-8 diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index c3b5fe9ac46b..638e1b9345ea 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -68,6 +68,7 @@ org.codehaus.mojo build-helper-maven-plugin + 1.10 add_sources @@ -104,7 +105,7 @@ 1.7 - + org.codehaus.mojo exec-maven-plugin @@ -123,14 +124,6 @@ - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - sbt-test integration-test @@ -146,7 +139,6 @@ - @@ -185,5 +177,6 @@ 2.6.2 1.0.0 4.12 + UTF-8 diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java index 974c3becece7..52f50890ee7a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java @@ -3,7 +3,7 @@ package io.swagger.client; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T22:17:12.179+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-02T16:59:44.170+08:00") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java index 46a1778050a0..8bdc725b16ba 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T22:17:12.179+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-02T16:59:44.170+08:00") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java index e3848de9f9e2..78b5ef4b659f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T22:17:12.179+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-02T16:59:44.170+08:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java index fe552d7ae8de..73b7f76070c3 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T22:17:12.179+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-02T16:59:44.170+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 6b157ac6601c..cb388174bfc0 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T22:17:12.179+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-02T16:59:44.170+08:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java index c097462f5cd8..ef8c42b0ea39 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T22:17:12.179+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-02T16:59:44.170+08:00") public class OAuth implements Authentication { private String accessToken;