From bd81dfd08e4b04cc83e8dd50dc1a1541bc6a4c6e Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 23 Mar 2017 14:51:00 +0800 Subject: [PATCH 1/6] use base name for parameters in the curl command (#5173) --- .../swagger-codegen/src/main/resources/htmlDocs2/index.mustache | 2 +- samples/html2/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs2/index.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs2/index.mustache index fff1193d70ce..c529d8d58c83 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs2/index.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs2/index.mustache @@ -224,7 +224,7 @@
-
curl -X {{httpMethod}}{{#authMethods}}{{#isApiKey}}{{#isKeyInHeader}} -H "{{keyParamName}}: [[apiKey]]"{{/isKeyInHeader}}{{/isApiKey}}{{#isBasic}}{{#hasProduces}} -H "Accept: {{#produces}}{{{mediaType}}}{{#hasMore}},{{/hasMore}}{{/produces}}"{{/hasProduces}}{{#hasConsumes}} -H "Content-Type: {{#consumes}}{{{mediaType}}}{{#hasMore}},{{/hasMore}}{{/consumes}}"{{/hasConsumes}} -H "Authorization: Basic [[basicHash]]"{{/isBasic}}{{/authMethods}} "{{basePath}}{{path}}{{#hasQueryParams}}?{{#queryParams}}{{^-first}}&{{/-first}}{{paramName}}={{vendorExtensions.x-eg}}{{/queryParams}}{{/hasQueryParams}}"
+
curl -X {{httpMethod}}{{#authMethods}}{{#isApiKey}}{{#isKeyInHeader}} -H "{{keyParamName}}: [[apiKey]]"{{/isKeyInHeader}}{{/isApiKey}}{{#isBasic}}{{#hasProduces}} -H "Accept: {{#produces}}{{{mediaType}}}{{#hasMore}},{{/hasMore}}{{/produces}}"{{/hasProduces}}{{#hasConsumes}} -H "Content-Type: {{#consumes}}{{{mediaType}}}{{#hasMore}},{{/hasMore}}{{/consumes}}"{{/hasConsumes}} -H "Authorization: Basic [[basicHash]]"{{/isBasic}}{{/authMethods}} "{{basePath}}{{path}}{{#hasQueryParams}}?{{#queryParams}}{{^-first}}&{{/-first}}{{baseName}}={{vendorExtensions.x-eg}}{{/queryParams}}{{/hasQueryParams}}"
{{>sample_java}}
diff --git a/samples/html2/index.html b/samples/html2/index.html index fdf3c580196a..fb509613ef95 100644 --- a/samples/html2/index.html +++ b/samples/html2/index.html @@ -7293,7 +7293,7 @@ except ApiException as e:
- Generated 2017-03-21T22:07:17.642+08:00 + Generated 2017-03-23T14:23:30.922+08:00
From 55b7db34563e4b8f601a8d12637200e286687a72 Mon Sep 17 00:00:00 2001 From: Benjamin Douglas Date: Thu, 23 Mar 2017 00:01:07 -0700 Subject: [PATCH 2/6] #5142: Add @QueryMap support for Feign API (#5143) * use builder pattern for operations * @QueryMap parameter only for query parameters The previous iteration had replaced all parameters (body, path, query, etc) within a single @QueryMap. But Feign only supports this style of parameter passing for query parameters. Besides, for the case of a body parameter (like soxhlet uses) it only added extra verbosity. With this change, the query parameters are gathered together in a single @QueryMap and the other parameters are left alone. * Adding template for generating test code * Make javadoc consistent with rest of file's conventions/indents * Update samples The files in src/main were generated by running $ bin/java-petstore-feign.sh The files in src/test were manually fixed. * Correct capitalization of @QueryMap class in feign Adds a field operationIdCamelCase (a la operationIdLowerCase) to the CodegenOperation container and uses it in the feign-generated classes with @QueryMap parameters. Also re-generated the feign samples. * Adding hyphen to javadocs for extra readability. * Adding (not replacing) api method with @QueryParam overload. In order to keep backwards compatibility, switched to adding a new method to the interface instead of replacing the old call. * Adding newline to generated source for readability. --- .../io/swagger/codegen/CodegenOperation.java | 6 +- .../io/swagger/codegen/DefaultCodegen.java | 1 + .../languages/ElixirClientCodegen.java | 1 + .../Java/libraries/feign/api.mustache | 48 ++++++++++++++ .../Java/libraries/feign/api_test.mustache | 26 ++++++++ .../java/io/swagger/client/api/FakeApi.java | 50 ++++++++++++++ .../java/io/swagger/client/api/PetApi.java | 66 +++++++++++++++++++ .../java/io/swagger/client/api/UserApi.java | 38 +++++++++++ .../io/swagger/client/api/PetApiTest.java | 29 ++++++++ .../io/swagger/client/api/UserApiTest.java | 6 ++ 10 files changed, 270 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java index fc07e0d7174b..c72a844e056f 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenOperation.java @@ -36,6 +36,7 @@ public class CodegenOperation { public Map vendorExtensions; public String nickname; // legacy support public String operationIdLowerCase; // for mardown documentation + public String operationIdCamelCase; // for class names /** * Check if there's at least one parameter @@ -279,7 +280,9 @@ public class CodegenOperation { return false; if ( prioritizedContentTypes != null ? !prioritizedContentTypes.equals(that.prioritizedContentTypes) : that.prioritizedContentTypes != null ) return false; - return operationIdLowerCase != null ? operationIdLowerCase.equals(that.operationIdLowerCase) : that.operationIdLowerCase == null; + if ( operationIdLowerCase != null ? !operationIdLowerCase.equals(that.operationIdLowerCase) : that.operationIdLowerCase != null ) + return false; + return operationIdCamelCase != null ? operationIdCamelCase.equals(that.operationIdCamelCase) : that.operationIdCamelCase == null; } @@ -332,6 +335,7 @@ public class CodegenOperation { result = 31 * result + (nickname != null ? nickname.hashCode() : 0); result = 31 * result + (prioritizedContentTypes != null ? prioritizedContentTypes.hashCode() : 0); result = 31 * result + (operationIdLowerCase != null ? operationIdLowerCase.hashCode() : 0); + result = 31 * result + (operationIdCamelCase != null ? operationIdCamelCase.hashCode() : 0); return result; } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 8e9449bdfde1..e684a94e3752 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -2827,6 +2827,7 @@ public class DefaultCodegen { } co.operationId = uniqueName; co.operationIdLowerCase = uniqueName.toLowerCase(); + co.operationIdCamelCase = DefaultCodegen.camelize(uniqueName); opList.add(co); co.baseName = tag; } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ElixirClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ElixirClientCodegen.java index 1a611e4d5909..21a237dd1b6b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ElixirClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ElixirClientCodegen.java @@ -356,6 +356,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig this.vendorExtensions = o.vendorExtensions; this.nickname = o.nickname; this.operationIdLowerCase = o.operationIdLowerCase; + this.operationIdCamelCase = o.operationIdCamelCase; } public List getPathTemplateNames() { diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api.mustache index ce2c205ea9d9..df26e39fc55e 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api.mustache @@ -38,6 +38,54 @@ public interface {{classname}} extends ApiClient.Api { {{/hasMore}}{{/headerParams}} }) {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#hasQueryParams}} + + /** + * {{summary}} + * {{notes}} + * Note, this is equivalent to the other {{operationId}} method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link {{operationIdCamelCase}}QueryParams} class that allows for + * building up this map in a fluent style. + {{#allParams}} + {{^isQueryParam}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} + {{/isQueryParam}} + {{/allParams}} + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + {{#queryParams}} + *
  • {{paramName}} - {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
  • + {{/queryParams}} + *
+ {{#returnType}} + * @return {{returnType}} + {{/returnType}} + */ + @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{#hasMore}}&{{/hasMore}}{{/queryParams}}") + @Headers({ + "Content-Type: {{vendorExtensions.x-contentType}}", + "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} + "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#hasMore}}, + {{/hasMore}}{{/headerParams}} + }) + {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap Map queryParams); + + /** + * A convenience class for generating query parameters for the + * {{operationId}} method in a fluent style. + */ + public static class {{operationIdCamelCase}}QueryParams extends HashMap { + {{#queryParams}} + public {{operationIdCamelCase}}QueryParams {{paramName}}(final {{{dataType}}} value) { + put("{{paramName}}", value); + return this; + } + {{/queryParams}} + } + {{/hasQueryParams}} {{/operation}} {{/operations}} } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api_test.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api_test.mustache index 303fda344e99..bcc14a987c68 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api_test.mustache @@ -40,5 +40,31 @@ public class {{classname}}Test { // TODO: test validations } + + {{#hasQueryParams}} + /** + * {{summary}} + * + * {{notes}} + * + * This tests the overload of the method that uses a Map for query parameters instead of + * listing them out individually. + */ + @Test + public void {{operationId}}TestQueryMap() { + {{#allParams}} + {{^isQueryParam}} + {{{dataType}}} {{paramName}} = null; + {{/isQueryParam}} + {{/allParams}} + {{classname}}.{{operationIdCamelCase}}QueryParams queryParams = new {{classname}}.{{operationIdCamelCase}}QueryParams() + {{#queryParams}} + .{{paramName}}(null){{^hasMore}};{{/hasMore}} + {{/queryParams}} + // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{^isQueryParam}}{{paramName}}, {{/isQueryParam}}{{/allParams}}queryParams); + + // TODO: test validations + } + {{/hasQueryParams}} {{/operation}}{{/operations}} } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java index 0b30eeb442c2..0e634f7bc6e6 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java @@ -76,4 +76,54 @@ public interface FakeApi extends ApiClient.Api { "enum_header_string: {enumHeaderString}" }) void testEnumParameters(@Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble); + + /** + * To test enum parameters + * To test enum parameters + * Note, this is equivalent to the other testEnumParameters method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link TestEnumParametersQueryParams} class that allows for + * building up this map in a fluent style. + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • enumQueryStringArray - Query parameter enum test (string array) (optional)
  • + *
  • enumQueryString - Query parameter enum test (string) (optional, default to -efg)
  • + *
  • enumQueryInteger - Query parameter enum test (double) (optional)
  • + *
+ */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}") + @Headers({ + "Content-Type: */*", + "Accept: */*", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + void testEnumParameters(@Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryDouble") Double enumQueryDouble, @QueryMap Map queryParams); + + /** + * A convenience class for generating query parameters for the + * testEnumParameters method in a fluent style. + */ + public static class TestEnumParametersQueryParams extends HashMap { + public TestEnumParametersQueryParams enumQueryStringArray(final List value) { + put("enumQueryStringArray", value); + return this; + } + public TestEnumParametersQueryParams enumQueryString(final String value) { + put("enumQueryString", value); + return this; + } + public TestEnumParametersQueryParams enumQueryInteger(final Integer value) { + put("enumQueryInteger", value); + return this; + } + } } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index 05133620f821..48987c67f380 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -55,6 +55,39 @@ public interface PetApi extends ApiClient.Api { }) List findPetsByStatus(@Param("status") List status); + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * Note, this is equivalent to the other findPetsByStatus method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link FindPetsByStatusQueryParams} class that allows for + * building up this map in a fluent style. + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • status - Status values that need to be considered for filter (required)
  • + *
+ * @return List<Pet> + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + List findPetsByStatus(@QueryMap Map queryParams); + + /** + * A convenience class for generating query parameters for the + * findPetsByStatus method in a fluent style. + */ + public static class FindPetsByStatusQueryParams extends HashMap { + public FindPetsByStatusQueryParams status(final List value) { + put("status", value); + return this; + } + } + /** * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -68,6 +101,39 @@ public interface PetApi extends ApiClient.Api { }) List findPetsByTags(@Param("tags") List tags); + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Note, this is equivalent to the other findPetsByTags method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link FindPetsByTagsQueryParams} class that allows for + * building up this map in a fluent style. + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • tags - Tags to filter by (required)
  • + *
+ * @return List<Pet> + */ + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + List findPetsByTags(@QueryMap Map queryParams); + + /** + * A convenience class for generating query parameters for the + * findPetsByTags method in a fluent style. + */ + public static class FindPetsByTagsQueryParams extends HashMap { + public FindPetsByTagsQueryParams tags(final List value) { + put("tags", value); + return this; + } + } + /** * Find pet by ID * Returns a single pet diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java index ae2ea06f9b60..c271b9deda80 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java @@ -89,6 +89,44 @@ public interface UserApi extends ApiClient.Api { }) String loginUser(@Param("username") String username, @Param("password") String password); + /** + * Logs user into the system + * + * Note, this is equivalent to the other loginUser method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link LoginUserQueryParams} class that allows for + * building up this map in a fluent style. + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • username - The user name for login (required)
  • + *
  • password - The password for login in clear text (required)
  • + *
+ * @return String + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + String loginUser(@QueryMap Map queryParams); + + /** + * A convenience class for generating query parameters for the + * loginUser method in a fluent style. + */ + public static class LoginUserQueryParams extends HashMap { + public LoginUserQueryParams username(final String value) { + put("username", value); + return this; + } + public LoginUserQueryParams password(final String value) { + put("password", value); + return this; + } + } + /** * Logs out current logged in user session * diff --git a/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/PetApiTest.java b/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/PetApiTest.java index fd649e0f9f47..19e44086a51e 100644 --- a/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/PetApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/PetApiTest.java @@ -83,6 +83,21 @@ public class PetApiTest { } assertTrue(found); + + PetApi.FindPetsByStatusQueryParams queryParams = new PetApi.FindPetsByStatusQueryParams() + .status(Arrays.asList(new String[]{"available"})); + pets = api.findPetsByStatus(queryParams); + assertNotNull(pets); + + found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + + assertTrue(found); } @Test @@ -110,6 +125,20 @@ public class PetApiTest { } } assertTrue(found); + + PetApi.FindPetsByTagsQueryParams queryParams = new PetApi.FindPetsByTagsQueryParams() + .tags(Arrays.asList(new String[]{"friendly"})); + pets = api.findPetsByTags(queryParams); + assertNotNull(pets); + + found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + assertTrue(found); } @Test diff --git a/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/UserApiTest.java b/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/UserApiTest.java index 513c84516ade..be7535306706 100644 --- a/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/UserApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/UserApiTest.java @@ -66,6 +66,12 @@ public class UserApiTest { String token = api.loginUser(user.getUsername(), user.getPassword()); assertTrue(token.startsWith("logged in user session:")); + + UserApi.LoginUserQueryParams queryParams = new UserApi.LoginUserQueryParams() + .username(user.getUsername()) + .password(user.getPassword()); + token = api.loginUser(queryParams); + assertTrue(token.startsWith("logged in user session:")); } @Test From 5f27fcab18083526ca2b8033f70dc21f2ac846a7 Mon Sep 17 00:00:00 2001 From: David Biesack Date: Thu, 23 Mar 2017 03:15:01 -0400 Subject: [PATCH 3/6] Add support for Markdown in -l html (#5144) * Sync with upstream/master * Support Markdown in -l html Add https://github.com/atlassian/commonmark-java to modules/swagger-codegen to convert Markdown to HTML, update StaticHtmlGenerator to use this (see the toHeml() method and its uses) Add a new test case bin/html-markdown.sh and modules/swagger-codegen/src/test/resources/2_0/markdown.yaml * Support Markdown in -l html Add https://github.com/atlassian/commonmark-java to modules/swagger-codegen to convert Markdown to HTML, update StaticHtmlGenerator to use this (see the toHeml() method and its uses) Add a new test case bin/html-markdown.sh and modules/swagger-codegen/src/test/resources/2_0/markdown.yaml --- bin/html-markdown.sh | 31 ++ modules/swagger-codegen/pom.xml | 5 + .../languages/StaticHtmlGenerator.java | 84 +++++- .../io/swagger/codegen/utils/Markdown.java | 47 +++ .../src/test/resources/2_0/markdown.yaml | 75 +++++ pom.xml | 12 +- samples/html.md/.swagger-codegen-ignore | 23 ++ samples/html.md/index.html | 278 ++++++++++++++++++ samples/html/index.html | 116 ++++---- 9 files changed, 601 insertions(+), 70 deletions(-) create mode 100755 bin/html-markdown.sh create mode 100644 modules/swagger-codegen/src/main/java/io/swagger/codegen/utils/Markdown.java create mode 100644 modules/swagger-codegen/src/test/resources/2_0/markdown.yaml create mode 100644 samples/html.md/.swagger-codegen-ignore create mode 100644 samples/html.md/index.html diff --git a/bin/html-markdown.sh b/bin/html-markdown.sh new file mode 100755 index 000000000000..089abfc5e8f5 --- /dev/null +++ b/bin/html-markdown.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 -i modules/swagger-codegen/src/test/resources/2_0/markdown.yaml -l html -o samples/html.md" + +java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/pom.xml b/modules/swagger-codegen/pom.xml index 2802b90a1e8e..05206eb2f9b0 100644 --- a/modules/swagger-codegen/pom.xml +++ b/modules/swagger-codegen/pom.xml @@ -273,6 +273,11 @@ ${diffutils-version} test + + com.atlassian.commonmark + commonmark + 0.9.0 + diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java index 1a69811723ec..a22010e51fb4 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java @@ -3,22 +3,31 @@ package io.swagger.codegen.languages; import io.swagger.codegen.CliOption; import io.swagger.codegen.CodegenConfig; import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.CodegenModel; import io.swagger.codegen.CodegenOperation; +import io.swagger.codegen.CodegenParameter; +import io.swagger.codegen.CodegenProperty; import io.swagger.codegen.CodegenResponse; import io.swagger.codegen.CodegenType; import io.swagger.codegen.DefaultCodegen; import io.swagger.codegen.SupportingFile; -import io.swagger.models.Operation; +import io.swagger.models.Info; +import io.swagger.models.Model; +import io.swagger.models.Swagger; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.MapProperty; import io.swagger.models.properties.Property; - -import java.util.ArrayList; +import io.swagger.codegen.utils.Markdown; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import com.samskivert.mustache.Escapers; +import com.samskivert.mustache.Mustache.Compiler; + +import io.swagger.codegen.utils.Markdown; + public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig { protected String invokerPackage = "io.swagger.client"; protected String groupId = "io.swagger"; @@ -61,13 +70,19 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig importMapping = new HashMap(); } - @Override + + + /** + * Convert Markdown (CommonMark) to HTML. This class also disables normal HTML + * escaping in the Mustache engine (see {@link #processCompiler(Compiler)} above.) + */ + @Override public String escapeText(String input) { // newline escaping disabled for HTML documentation for markdown to work correctly - return input; + return toHtml(input); } - @Override + @Override public CodegenType getTag() { return CodegenType.DOCUMENTATION; } @@ -124,4 +139,61 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig // just return the original string return input; } + + /** + * Markdown conversion emits HTML and by default, the Mustache + * {@link Compiler} will escape HTML. For example a summary + * "Text with **bold**" is converted from Markdown to HTML as + * "Text with <strong>bold</strong> text" and then + * the default compiler with HTML escaping on turns this into + * "Text with &lt;strong&gt;bold&lt;/strong&gt; text". + * Here, we disable escaping by setting the compiler to {@link Escapers#NONE + * Escapers.NONE} + */ + @Override + public Compiler processCompiler(Compiler compiler) { + return compiler.withEscaper(Escapers.NONE); + } + + private Markdown markdownConverter = new Markdown(); + + private static final boolean CONVERT_TO_MARKDOWN_VIA_ESCAPE_TEXT = false; + + /** + * Convert Markdown text to HTML + * @param input text in Markdown; may be null. + * @return the text, converted to Markdown. For null input, "" is returned. + */ + public String toHtml(String input) { + if (input == null) + return ""; + return markdownConverter.toHtml(input); + } + + public void preprocessSwagger(Swagger swagger) { + Info info = swagger.getInfo(); + info.setDescription(toHtml(info.getDescription())); + info.setTitle(toHtml(info.getTitle())); + Map models = swagger.getDefinitions(); + for (Model model : models.values()) { + model.setDescription(toHtml(model.getDescription())); + model.setTitle(toHtml(model.getTitle())); + } + } + + // override to post-process any parameters + public void postProcessParameter(CodegenParameter parameter) { + parameter.description = toHtml(parameter.description); + parameter.unescapedDescription = toHtml( + parameter.unescapedDescription); + } + + // override to post-process any model properties + public void postProcessModelProperty(CodegenModel model, + CodegenProperty property) { + property.description = toHtml(property.description); + property.unescapedDescription = toHtml( + property.unescapedDescription); + } + } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/utils/Markdown.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/utils/Markdown.java new file mode 100644 index 000000000000..f57f59e9842d --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/utils/Markdown.java @@ -0,0 +1,47 @@ +package io.swagger.codegen.utils; + +import org.commonmark.node.Node; +import org.commonmark.parser.Parser; +import org.commonmark.renderer.html.HtmlRenderer; + + +/** + * Utility class to convert Markdown (CommonMark) to HTML. + * This class is threadsafe. + */ +public class Markdown { + + // see https://github.com/atlassian/commonmark-java + private final Parser parser = Parser.builder().build(); + private final HtmlRenderer renderer = HtmlRenderer.builder().build(); + + /** + * Convert input markdown text to HTML. + * Simple text is not wrapped in

...

. + * @param markdown text with Markdown styles. If null, "" is returned. + * @return HTML rendering from the Markdown + */ + public String toHtml(String markdown) { + if (markdown == null) + return ""; + Node document = parser.parse(markdown); + String html = renderer.render(document); + html = unwrapped(html); + return html; + } + + // The CommonMark library wraps the HTML with + //

... html ...

\n + // This method removes that markup wrapper if there are no other

elements, + // do that Markdown can be used in non-block contexts such as operation summary etc. + private static final String P_END = "

\n"; + private static final String P_START = "

"; + private String unwrapped(String html) { + if (html.startsWith(P_START) && html.endsWith(P_END) + && html.lastIndexOf(P_START) == 0) + return html.substring(P_START.length(), + html.length() - P_END.length()); + else + return html; + } +} diff --git a/modules/swagger-codegen/src/test/resources/2_0/markdown.yaml b/modules/swagger-codegen/src/test/resources/2_0/markdown.yaml new file mode 100644 index 000000000000..efb852f40367 --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/2_0/markdown.yaml @@ -0,0 +1,75 @@ +swagger: '2.0' + +info: + version: '0.1.0' + title: An *API* with more **Markdown** in summary, description, and other text + description: > + Not really a *pseudo-randum* number generator API. + This API uses [Markdown](http://daringfireball.net/projects/markdown/syntax) + in text: + + 1. in this API description + + 1. in operation summaries + + 1. in operation descriptions + + 1. in schema (model) titles and descriptions + + 1. in schema (model) member descriptions + +schemes: + - http +host: api.example.com +basePath: /v1 +tags: + - name: tag1 + description: A simple API **tag** +securityDefinitions: + apiKey: + type: apiKey + in: header + name: api_key +security: + - apiKey: [] + +paths: + + /random: + get: + tags: + - tag1 + summary: A single *random* result + description: Return a single *random* result from a given seed + operationId: getRandomNumber + parameters: + - name: seed + in: query + description: A random number *seed*. + required: true + type: string + responses: + '200': + description: Operation *succeded* + schema: + $ref: '#/definitions/RandomNumber' + '404': + description: Invalid or omitted *seed*. Seeds must be **valid** numbers. + +definitions: + RandomNumber: + title: '*Pseudo-random* number' + description: A *pseudo-random* number generated from a seed. + properties: + value: + description: The *pseudo-random* number + type: number + format: double + seed: + description: The `seed` used to generate this number + type: number + format: double + sequence: + description: The sequence number of this random number. + type: integer + format: int64 diff --git a/pom.xml b/pom.xml index c1270d71aeb6..2aff5fef3cd9 100644 --- a/pom.xml +++ b/pom.xml @@ -772,7 +772,6 @@ samples/client/petstore/jaxrs-cxf-client samples/client/petstore/javascript samples/client/petstore/python - samples/client/petstore/spring-cloud samples/client/petstore/scala samples/client/petstore/typescript-fetch/builds/default samples/client/petstore/typescript-fetch/builds/es6-target @@ -785,19 +784,20 @@ samples/server/petstore/java-inflector - samples/server/petstore/java-play-framework + samples/server/petstore/undertow samples/server/petstore/jaxrs/jersey1 samples/server/petstore/jaxrs/jersey2 samples/server/petstore/jaxrs-resteasy/default samples/server/petstore/jaxrs-resteasy/joda + samples/server/petstore/scalatra + samples/server/petstore/spring-mvc + samples/client/petstore/spring-cloud + samples/server/petstore/springboot samples/server/petstore/jaxrs-cxf samples/server/petstore/jaxrs-cxf-annotated-base-path samples/server/petstore/jaxrs-cxf-cdi samples/server/petstore/jaxrs-cxf-non-spring-app - samples/server/petstore/scalatra - samples/server/petstore/spring-mvc - samples/server/petstore/springboot - samples/server/petstore/undertow + diff --git a/samples/html.md/.swagger-codegen-ignore b/samples/html.md/.swagger-codegen-ignore new file mode 100644 index 000000000000..c5fa491b4c55 --- /dev/null +++ b/samples/html.md/.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 +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/html.md/index.html b/samples/html.md/index.html new file mode 100644 index 000000000000..28cbed90cc3b --- /dev/null +++ b/samples/html.md/index.html @@ -0,0 +1,278 @@ + + + + An <em>API</em> with more <strong>Markdown</strong> in summary, description, and other text + + + +

An API with more Markdown in summary, description, and other text

+

Not really a pseudo-randum number generator API. This API uses Markdown in text:

+
    +
  1. in this API description
  2. +
  3. in operation summaries
  4. +
  5. in operation descriptions
  6. +
  7. in schema (model) titles and descriptions
  8. +
  9. in schema (model) member descriptions
  10. +
+
+
More information: https://helloreverb.com
+
Contact Info: hello@helloreverb.com
+
Version: 0.1.0
+
BasePath:/v1
+
All rights reserved
+
http://apache.org/licenses/LICENSE-2.0.html
+

Access

+
    +
  1. APIKey KeyParamName:api_key KeyInQuery:false KeyInHeader:true
  2. +
+ +

Methods

+ [ Jump to Models ] + +

Table of Contents

+
+

Tag1

+ + +

Tag1

+
+
+ Up +
get /random
+
A single random result (getRandomNumber)
+
Return a single random result from a given seed
+ + + + + +

Query parameters

+
+
seed (required)
+ +
Query Parameter — A random number seed.
+
+ + +

Return type

+
+ RandomNumber + +
+ + + +

Example data

+
Content-Type: application/json
+
{
+  "sequence" : 1,
+  "seed" : 6.027456183070403,
+  "value" : 0.8008281904610115
+}
+ + +

Responses

+

200

+ Operation succeded + RandomNumber +

404

+ Invalid or omitted seed. Seeds must be valid numbers. + +
+
+ +

Models

+ [ Jump to Methods ] + +

Table of Contents

+
    +
  1. RandomNumber - Pseudo-random number
  2. +
+ +
+

RandomNumber - Pseudo-random number Up

+
A pseudo-random number generated from a seed.
+
+
value (optional)
Double The pseudo-random number format: double
+
seed (optional)
Double The seed used to generate this number format: double
+
sequence (optional)
Long The sequence number of this random number. format: int64
+
+
+ + diff --git a/samples/html/index.html b/samples/html/index.html index 57726e2ecf8c..8638d803c182 100644 --- a/samples/html/index.html +++ b/samples/html/index.html @@ -180,8 +180,8 @@ font-style: italic;

Swagger Petstore

-
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.
- +
This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key special-key to test the authorization filters.
+
More information:
Contact Info: apiteam@swagger.io
Version: 1.0.0
BasePath:/v2
@@ -356,18 +356,18 @@ font-style: italic;

Example data

Content-Type: application/json
[ {
-  "tags" : [ {
-    "id" : 7,
-    "name" : "aeiou"
-  } ],
-  "id" : 2,
-  "category" : {
-    "id" : 2,
-    "name" : "aeiou"
-  },
-  "status" : "available",
+  "photoUrls" : [ "aeiou" ],
   "name" : "doggie",
-  "photoUrls" : [ "aeiou" ]
+  "id" : 0,
+  "category" : {
+    "name" : "aeiou",
+    "id" : 6
+  },
+  "tags" : [ {
+    "name" : "aeiou",
+    "id" : 1
+  } ],
+  "status" : "available"
 } ]

Produces

@@ -429,18 +429,18 @@ font-style: italic;

Example data

Content-Type: application/json
[ {
-  "tags" : [ {
-    "id" : 1,
-    "name" : "aeiou"
-  } ],
-  "id" : 9,
-  "category" : {
-    "id" : 4,
-    "name" : "aeiou"
-  },
-  "status" : "available",
+  "photoUrls" : [ "aeiou" ],
   "name" : "doggie",
-  "photoUrls" : [ "aeiou" ]
+  "id" : 0,
+  "category" : {
+    "name" : "aeiou",
+    "id" : 6
+  },
+  "tags" : [ {
+    "name" : "aeiou",
+    "id" : 1
+  } ],
+  "status" : "available"
 } ]

Produces

@@ -502,18 +502,18 @@ font-style: italic;

Example data

Content-Type: application/json
{
-  "tags" : [ {
-    "id" : 5,
-    "name" : "aeiou"
-  } ],
-  "id" : 8,
-  "category" : {
-    "id" : 3,
-    "name" : "aeiou"
-  },
-  "status" : "available",
+  "photoUrls" : [ "aeiou" ],
   "name" : "doggie",
-  "photoUrls" : [ "aeiou" ]
+  "id" : 0,
+  "category" : {
+    "name" : "aeiou",
+    "id" : 6
+  },
+  "tags" : [ {
+    "name" : "aeiou",
+    "id" : 1
+  } ],
+  "status" : "available"
 }

Produces

@@ -679,9 +679,9 @@ font-style: italic;

Example data

Content-Type: application/json
{
-  "message" : "aeiou",
-  "code" : 3,
-  "type" : "aeiou"
+  "code" : 0,
+  "type" : "aeiou",
+  "message" : "aeiou"
 }

Produces

@@ -762,7 +762,7 @@ font-style: italic;

Example data

Content-Type: application/json
{
-  "key" : 9
+  "key" : 0
 }

Produces

@@ -783,7 +783,7 @@ font-style: italic; Up
get /store/order/{orderId}
Find purchase order by ID (getOrderById)
-
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions

Path parameters

@@ -818,12 +818,12 @@ font-style: italic;

Example data

Content-Type: application/json
{
-  "id" : 5,
-  "petId" : 8,
+  "petId" : 6,
+  "quantity" : 1,
+  "id" : 0,
+  "shipDate" : "2000-01-23T04:56:07.000+00:00",
   "complete" : false,
-  "status" : "placed",
-  "quantity" : 4,
-  "shipDate" : "2000-01-23T04:56:07.000+00:00"
+  "status" : "placed"
 }

Produces

@@ -887,12 +887,12 @@ font-style: italic;

Example data

Content-Type: application/json
{
-  "id" : 6,
-  "petId" : 9,
+  "petId" : 6,
+  "quantity" : 1,
+  "id" : 0,
+  "shipDate" : "2000-01-23T04:56:07.000+00:00",
   "complete" : false,
-  "status" : "placed",
-  "quantity" : 2,
-  "shipDate" : "2000-01-23T04:56:07.000+00:00"
+  "status" : "placed"
 }

Produces

@@ -1078,7 +1078,7 @@ font-style: italic;
username (required)
-
Path Parameter — The name that needs to be fetched. Use user1 for testing.
+
Path Parameter — The name that needs to be fetched. Use user1 for testing.
@@ -1109,14 +1109,14 @@ font-style: italic;

Example data

Content-Type: application/json
{
-  "id" : 4,
-  "lastName" : "aeiou",
-  "phone" : "aeiou",
-  "username" : "aeiou",
-  "email" : "aeiou",
-  "userStatus" : 1,
   "firstName" : "aeiou",
-  "password" : "aeiou"
+  "lastName" : "aeiou",
+  "password" : "aeiou",
+  "userStatus" : 6,
+  "phone" : "aeiou",
+  "id" : 0,
+  "email" : "aeiou",
+  "username" : "aeiou"
 }

Produces

From a30c5cbe7096bc56c0d5b55ffbb54345623d8bbd Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 23 Mar 2017 15:21:46 +0800 Subject: [PATCH 4/6] include bin/java-petstore-jersey2-java6.sh in java-petstoreall.sh --- bin/java-petstore-all.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/java-petstore-all.sh b/bin/java-petstore-all.sh index fbd2ca65cad9..11148e31c9fb 100755 --- a/bin/java-petstore-all.sh +++ b/bin/java-petstore-all.sh @@ -10,3 +10,4 @@ ./bin/java-petstore-retrofit2rx.sh ./bin/java8-petstore-jersey2.sh ./bin/java-petstore-retrofit2-play24.sh +./bin/java-petstore-jersey2-java6.sh From 9dc8cf3fa6d38a0e65a6ad8adfacb2034ed820b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Thu, 23 Mar 2017 08:22:14 +0100 Subject: [PATCH 5/6] Update samples for java/jersey2-java6 (and fix artifact ID) (#5118) * Update samples for java/jersey2-java6. * Let the sample generation script set the right name for jersey2-java6. This is the equivalent change to #5095, for jersey2-java6. * Update samples for Java/Jersey2-java6. --- bin/java-petstore-jersey2-java6.sh | 2 +- .../petstore/java/jersey2-java6/.travis.yml | 12 - .../petstore/java/jersey2-java6/build.gradle | 2 +- .../petstore/java/jersey2-java6/build.sbt | 2 +- .../java/jersey2-java6/docs/Capitalization.md | 15 + .../java/jersey2-java6/docs/ClassModel.md | 10 + .../java/jersey2-java6/docs/EnumTest.md | 1 + .../java/jersey2-java6/docs/FakeApi.md | 14 +- .../java/jersey2-java6/docs/FormatTest.md | 2 +- ...dPropertiesAndAdditionalPropertiesClass.md | 2 +- .../java/jersey2-java6/docs/OuterEnum.md | 14 + .../petstore/java/jersey2-java6/effective.pom | 431 ------------------ .../petstore/java/jersey2-java6/pom.xml | 69 ++- .../java/jersey2-java6/settings.gradle | 2 +- .../java/io/swagger/client/ApiClient.java | 106 ++++- .../java/io/swagger/client/ApiException.java | 12 - .../java/io/swagger/client/Configuration.java | 12 - .../src/main/java/io/swagger/client/JSON.java | 1 + .../src/main/java/io/swagger/client/Pair.java | 12 - .../io/swagger/client/RFC3339DateFormat.java | 12 - .../java/io/swagger/client/StringUtil.java | 12 - .../java/io/swagger/client/api/FakeApi.java | 22 +- .../java/io/swagger/client/api/PetApi.java | 22 +- .../java/io/swagger/client/api/StoreApi.java | 10 +- .../java/io/swagger/client/api/UserApi.java | 16 +- .../io/swagger/client/auth/ApiKeyAuth.java | 12 - .../swagger/client/auth/Authentication.java | 12 - .../io/swagger/client/auth/HttpBasicAuth.java | 12 - .../java/io/swagger/client/auth/OAuth.java | 12 - .../io/swagger/client/auth/OAuthFlow.java | 12 - .../model/AdditionalPropertiesClass.java | 16 +- .../java/io/swagger/client/model/Animal.java | 23 +- .../io/swagger/client/model/AnimalFarm.java | 12 - .../model/ArrayOfArrayOfNumberOnly.java | 14 +- .../client/model/ArrayOfNumberOnly.java | 14 +- .../io/swagger/client/model/ArrayTest.java | 18 +- .../swagger/client/model/Capitalization.java | 204 +++++++++ .../java/io/swagger/client/model/Cat.java | 14 +- .../io/swagger/client/model/Category.java | 16 +- .../io/swagger/client/model/ClassModel.java | 90 ++++ .../java/io/swagger/client/model/Client.java | 14 +- .../java/io/swagger/client/model/Dog.java | 14 +- .../io/swagger/client/model/EnumArrays.java | 16 +- .../io/swagger/client/model/EnumClass.java | 12 - .../io/swagger/client/model/EnumTest.java | 46 +- .../io/swagger/client/model/FormatTest.java | 55 +-- .../swagger/client/model/HasOnlyReadOnly.java | 16 +- .../java/io/swagger/client/model/MapTest.java | 16 +- ...ropertiesAndAdditionalPropertiesClass.java | 27 +- .../client/model/Model200Response.java | 16 +- .../client/model/ModelApiResponse.java | 18 +- .../io/swagger/client/model/ModelReturn.java | 14 +- .../java/io/swagger/client/model/Name.java | 20 +- .../io/swagger/client/model/NumberOnly.java | 14 +- .../java/io/swagger/client/model/Order.java | 24 +- .../io/swagger/client/model/OuterEnum.java | 52 +++ .../java/io/swagger/client/model/Pet.java | 22 +- .../swagger/client/model/ReadOnlyFirst.java | 16 +- .../client/model/SpecialModelName.java | 14 +- .../java/io/swagger/client/model/Tag.java | 16 +- .../java/io/swagger/client/model/User.java | 28 +- 61 files changed, 707 insertions(+), 1059 deletions(-) create mode 100644 samples/client/petstore/java/jersey2-java6/docs/Capitalization.md create mode 100644 samples/client/petstore/java/jersey2-java6/docs/ClassModel.md create mode 100644 samples/client/petstore/java/jersey2-java6/docs/OuterEnum.md delete mode 100644 samples/client/petstore/java/jersey2-java6/effective.pom create mode 100644 samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Capitalization.java create mode 100644 samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ClassModel.java create mode 100644 samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/OuterEnum.java diff --git a/bin/java-petstore-jersey2-java6.sh b/bin/java-petstore-jersey2-java6.sh index e3e82f1cdd6b..8ab7c2c7ef48 100755 --- a/bin/java-petstore-jersey2-java6.sh +++ b/bin/java-petstore-jersey2-java6.sh @@ -26,7 +26,7 @@ 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 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java6 -DhideGenerationTimestamp=true,supportJava6=true" +ags="$@ generate --artifact-id swagger-petstore-jersey2-java6 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java6 -DhideGenerationTimestamp=true,supportJava6=true" echo "Removing files and folders under samples/client/petstore/java/jersey2/src/main" rm -rf samples/client/petstore/java/jersey2-java6/src/main diff --git a/samples/client/petstore/java/jersey2-java6/.travis.yml b/samples/client/petstore/java/jersey2-java6/.travis.yml index 33e79472abd8..70cb81a67c20 100644 --- a/samples/client/petstore/java/jersey2-java6/.travis.yml +++ b/samples/client/petstore/java/jersey2-java6/.travis.yml @@ -1,18 +1,6 @@ # # Generated by: https://github.com/swagger-api/swagger-codegen.git # -# 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. -# language: java jdk: - oraclejdk8 diff --git a/samples/client/petstore/java/jersey2-java6/build.gradle b/samples/client/petstore/java/jersey2-java6/build.gradle index 3aced963cc45..a4f6db249737 100644 --- a/samples/client/petstore/java/jersey2-java6/build.gradle +++ b/samples/client/petstore/java/jersey2-java6/build.gradle @@ -82,7 +82,7 @@ if(hasProperty('target') && target == 'android') { install { repositories.mavenInstaller { - pom.artifactId = 'swagger-petstore-jersey2' + pom.artifactId = 'swagger-petstore-jersey2-java6' } } diff --git a/samples/client/petstore/java/jersey2-java6/build.sbt b/samples/client/petstore/java/jersey2-java6/build.sbt index e4fccb57d6a5..d1d444bee2b7 100644 --- a/samples/client/petstore/java/jersey2-java6/build.sbt +++ b/samples/client/petstore/java/jersey2-java6/build.sbt @@ -1,7 +1,7 @@ lazy val root = (project in file(".")). settings( organization := "io.swagger", - name := "swagger-petstore-jersey2", + name := "swagger-petstore-jersey2-java6", version := "1.0.0", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), diff --git a/samples/client/petstore/java/jersey2-java6/docs/Capitalization.md b/samples/client/petstore/java/jersey2-java6/docs/Capitalization.md new file mode 100644 index 000000000000..0f3064c1996f --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/docs/Capitalization.md @@ -0,0 +1,15 @@ + +# Capitalization + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**scAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-java6/docs/ClassModel.md b/samples/client/petstore/java/jersey2-java6/docs/ClassModel.md new file mode 100644 index 000000000000..64f880c87869 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/docs/ClassModel.md @@ -0,0 +1,10 @@ + +# ClassModel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertyClass** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md b/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md index 29b6d288c8f4..08fee3448821 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md +++ b/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] diff --git a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md index 29813bd93492..4deb6e1d8519 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md @@ -15,6 +15,8 @@ Method | HTTP request | Description To test \"client\" model +To test \"client\" model + ### Example ```java // Import classes: @@ -137,6 +139,8 @@ null (empty response body) To test enum parameters +To test enum parameters + ### Example ```java // Import classes: @@ -151,7 +155,7 @@ List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_exampl String enumHeaderString = "-efg"; // String | Header parameter enum test (string) List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) -BigDecimal enumQueryInteger = new BigDecimal(); // BigDecimal | Query parameter enum test (double) +Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) try { apiInstance.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); @@ -171,8 +175,8 @@ Name | Type | Description | Notes **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **BigDecimal**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] ### Return type @@ -184,6 +188,6 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json + - **Content-Type**: */* + - **Accept**: */* diff --git a/samples/client/petstore/java/jersey2-java6/docs/FormatTest.md b/samples/client/petstore/java/jersey2-java6/docs/FormatTest.md index 44de7d9511a0..06bed417232a 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FormatTest.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FormatTest.md @@ -15,7 +15,7 @@ Name | Type | Description | Notes **binary** | **byte[]** | | [optional] **date** | [**LocalDate**](LocalDate.md) | | **dateTime** | [**DateTime**](DateTime.md) | | [optional] -**uuid** | **String** | | [optional] +**uuid** | [**UUID**](UUID.md) | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/java/jersey2-java6/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/jersey2-java6/docs/MixedPropertiesAndAdditionalPropertiesClass.md index e3487bcc5019..349afef35a98 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/java/jersey2-java6/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**uuid** | **String** | | [optional] +**uuid** | [**UUID**](UUID.md) | | [optional] **dateTime** | [**DateTime**](DateTime.md) | | [optional] **map** | [**Map<String, Animal>**](Animal.md) | | [optional] diff --git a/samples/client/petstore/java/jersey2-java6/docs/OuterEnum.md b/samples/client/petstore/java/jersey2-java6/docs/OuterEnum.md new file mode 100644 index 000000000000..ed2cb206789b --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/docs/OuterEnum.md @@ -0,0 +1,14 @@ + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/jersey2-java6/effective.pom b/samples/client/petstore/java/jersey2-java6/effective.pom deleted file mode 100644 index 70b95f7d5b58..000000000000 --- a/samples/client/petstore/java/jersey2-java6/effective.pom +++ /dev/null @@ -1,431 +0,0 @@ - - - - - - - - - - - - - - - - 4.0.0 - io.swagger - swagger-petstore-jersey2-java6 - 1.0.0 - swagger-petstore-jersey2-java6 - - 2.2.0 - - - scm:git:git@github.com:swagger-api/swagger-mustache.git - scm:git:git@github.com:swagger-api/swagger-codegen.git - https://github.com/swagger-api/swagger-codegen - - - 2.5 - 3.5 - 2.7.5 - 2.22.2 - 2.9.4 - 4.12 - 1.0.0 - 1.5.9 - - - - io.swagger - swagger-annotations - 1.5.9 - compile - - - org.glassfish.jersey.core - jersey-client - 2.22.2 - compile - - - org.glassfish.jersey.media - jersey-media-multipart - 2.22.2 - compile - - - org.glassfish.jersey.media - jersey-media-json-jackson - 2.22.2 - compile - - - com.fasterxml.jackson.core - jackson-core - 2.7.5 - compile - - - com.fasterxml.jackson.core - jackson-annotations - 2.7.5 - compile - - - com.fasterxml.jackson.core - jackson-databind - 2.7.5 - compile - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - 2.7.5 - compile - - - joda-time - joda-time - 2.9.4 - compile - - - com.brsanthu - migbase64 - 2.2 - compile - - - org.apache.commons - commons-lang3 - 3.5 - compile - - - commons-io - commons-io - 2.5 - compile - - - junit - junit - 4.12 - test - - - - - - false - - central - Central Repository - https://repo.maven.apache.org/maven2 - - - - - - never - - - false - - central - Central Repository - https://repo.maven.apache.org/maven2 - - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/src/main/java - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/src/main/scripts - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/src/test/java - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/classes - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/test-classes - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/src/main/resources - - - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/src/test/resources - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target - swagger-petstore-jersey2-java6-1.0.0 - - - - maven-antrun-plugin - 1.3 - - - maven-assembly-plugin - 2.2-beta-5 - - - maven-dependency-plugin - 2.8 - - - maven-release-plugin - 2.3.2 - - - - - - maven-surefire-plugin - 2.12 - - - default-test - test - - test - - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - maven-dependency-plugin - 2.8 - - - package - - copy-dependencies - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/lib - - - - - - maven-jar-plugin - 2.6 - - - default-jar - package - - jar - - - - - - jar - test-jar - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.12 - - - add_sources - generate-sources - - add-source - - - - src/main/java - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - src/test/java - - - - - - - maven-compiler-plugin - 2.5.1 - - - default-compile - compile - - compile - - - 1.7 - 1.7 - - - - default-testCompile - test-compile - - testCompile - - - 1.7 - 1.7 - - - - - 1.7 - 1.7 - - - - maven-javadoc-plugin - 2.10.4 - - - maven-clean-plugin - 2.5 - - - default-clean - clean - - clean - - - - - - maven-resources-plugin - 2.6 - - - default-testResources - process-test-resources - - testResources - - - - default-resources - process-resources - - resources - - - - - - maven-install-plugin - 2.4 - - - default-install - install - - install - - - - - - maven-deploy-plugin - 2.7 - - - default-deploy - deploy - - deploy - - - - - - maven-site-plugin - 3.3 - - - default-site - site - - site - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/site - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - - - - default-deploy - site-deploy - - deploy - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/site - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - - - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/site - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - - - - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/site - - \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2-java6/pom.xml b/samples/client/petstore/java/jersey2-java6/pom.xml index f9cf3667bb2c..f8833b5216b9 100644 --- a/samples/client/petstore/java/jersey2-java6/pom.xml +++ b/samples/client/petstore/java/jersey2-java6/pom.xml @@ -6,8 +6,10 @@ jar swagger-petstore-jersey2-java6 1.0.0 + https://github.com/swagger-api/swagger-codegen + Swagger Java - scm:git:git@github.com:swagger-api/swagger-mustache.git + scm:git:git@github.com:swagger-api/swagger-codegen.git scm:git:git@github.com:swagger-api/swagger-codegen.git https://github.com/swagger-api/swagger-codegen @@ -15,6 +17,23 @@ 2.2.0 + + + Unlicense + http://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + Swagger + apiteam@swagger.io + Swagger + http://swagger.io + + + @@ -108,9 +127,55 @@ org.apache.maven.plugins maven-javadoc-plugin 2.10.4 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + io.swagger @@ -189,7 +254,7 @@ - 1.5.9 + 1.5.12 2.22.2 2.7.5 2.9.4 diff --git a/samples/client/petstore/java/jersey2-java6/settings.gradle b/samples/client/petstore/java/jersey2-java6/settings.gradle index 498d426abeeb..4449df586597 100644 --- a/samples/client/petstore/java/jersey2-java6/settings.gradle +++ b/samples/client/petstore/java/jersey2-java6/settings.gradle @@ -1 +1 @@ -rootProject.name = "swagger-petstore-jersey2" \ No newline at end of file +rootProject.name = "swagger-petstore-jersey2-java6" \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java index d37be0a0de28..999d343919d3 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java @@ -86,6 +86,7 @@ public class ApiClient { /** * Gets the JSON instance to do JSON serialization and deserialization. + * @return JSON */ public JSON getJSON() { return json; @@ -111,6 +112,7 @@ public class ApiClient { /** * Gets the status code of the previous request + * @return Status code */ public int getStatusCode() { return statusCode; @@ -118,6 +120,7 @@ public class ApiClient { /** * Gets the response headers of the previous request + * @return Response headers */ public Map> getResponseHeaders() { return responseHeaders; @@ -125,6 +128,7 @@ public class ApiClient { /** * Get authentications (key: authentication name, value: authentication). + * @return Map of authentication object */ public Map getAuthentications() { return authentications; @@ -142,6 +146,7 @@ public class ApiClient { /** * Helper method to set username for the first HTTP basic authentication. + * @param username Username */ public void setUsername(String username) { for (Authentication auth : authentications.values()) { @@ -155,6 +160,7 @@ public class ApiClient { /** * Helper method to set password for the first HTTP basic authentication. + * @param password Password */ public void setPassword(String password) { for (Authentication auth : authentications.values()) { @@ -168,6 +174,7 @@ public class ApiClient { /** * Helper method to set API key value for the first API key authentication. + * @param apiKey API key */ public void setApiKey(String apiKey) { for (Authentication auth : authentications.values()) { @@ -181,6 +188,7 @@ public class ApiClient { /** * Helper method to set API key prefix for the first API key authentication. + * @param apiKeyPrefix API key prefix */ public void setApiKeyPrefix(String apiKeyPrefix) { for (Authentication auth : authentications.values()) { @@ -194,6 +202,7 @@ public class ApiClient { /** * Helper method to set access token for the first OAuth2 authentication. + * @param accessToken Access token */ public void setAccessToken(String accessToken) { for (Authentication auth : authentications.values()) { @@ -207,6 +216,8 @@ public class ApiClient { /** * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent Http user agent + * @return API client */ public ApiClient setUserAgent(String userAgent) { addDefaultHeader("User-Agent", userAgent); @@ -218,6 +229,7 @@ public class ApiClient { * * @param key The header's key * @param value The header's value + * @return API client */ public ApiClient addDefaultHeader(String key, String value) { defaultHeaderMap.put(key, value); @@ -226,6 +238,7 @@ public class ApiClient { /** * Check that whether debugging is enabled for this API client. + * @return True if debugging is switched on */ public boolean isDebugging() { return debugging; @@ -235,6 +248,7 @@ public class ApiClient { * Enable/disable debugging for this API client. * * @param debugging To enable (true) or disable (false) debugging + * @return API client */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; @@ -248,12 +262,17 @@ public class ApiClient { * with file response. The default value is null, i.e. using * the system's default tempopary folder. * - * @see https://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile(java.lang.String,%20java.lang.String,%20java.io.File) + * @return Temp folder path */ public String getTempFolderPath() { return tempFolderPath; } + /** + * Set temp folder path + * @param tempFolderPath Temp folder path + * @return API client + */ public ApiClient setTempFolderPath(String tempFolderPath) { this.tempFolderPath = tempFolderPath; return this; @@ -261,6 +280,7 @@ public class ApiClient { /** * Connect timeout (in milliseconds). + * @return Connection timeout */ public int getConnectTimeout() { return connectionTimeout; @@ -270,6 +290,8 @@ public class ApiClient { * Set the connect timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and * {@link Integer#MAX_VALUE}. + * @param connectionTimeout Connection timeout in milliseconds + * @return API client */ public ApiClient setConnectTimeout(int connectionTimeout) { this.connectionTimeout = connectionTimeout; @@ -279,6 +301,7 @@ public class ApiClient { /** * Get the date format used to parse/format date parameters. + * @return Date format */ public DateFormat getDateFormat() { return dateFormat; @@ -286,6 +309,8 @@ public class ApiClient { /** * Set the date format used to parse/format date parameters. + * @param dateFormat Date format + * @return API client */ public ApiClient setDateFormat(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -296,6 +321,8 @@ public class ApiClient { /** * Parse the given string into Date object. + * @param str String + * @return Date */ public Date parseDate(String str) { try { @@ -307,6 +334,8 @@ public class ApiClient { /** * Format the given Date object into string. + * @param date Date + * @return Date in string format */ public String formatDate(Date date) { return dateFormat.format(date); @@ -314,6 +343,8 @@ public class ApiClient { /** * Format the given parameter object into string. + * @param param Object + * @return Object in string format */ public String parameterToString(Object param) { if (param == null) { @@ -324,7 +355,7 @@ public class ApiClient { StringBuilder b = new StringBuilder(); for(Object o : (Collection)param) { if(b.length() > 0) { - b.append(","); + b.append(','); } b.append(String.valueOf(o)); } @@ -335,15 +366,19 @@ public class ApiClient { } /* - Format to {@code Pair} objects. - */ + * Format to {@code Pair} objects. + * @param collectionFormat Collection format + * @param name Name + * @param value Value + * @return List of pairs + */ public List parameterToPairs(String collectionFormat, String name, Object value){ List params = new ArrayList(); // preconditions if (name == null || name.isEmpty() || value == null) return params; - Collection valueCollection = null; + Collection valueCollection; if (value instanceof Collection) { valueCollection = (Collection) value; } else { @@ -355,11 +390,11 @@ public class ApiClient { return params; } - // get the collection format - collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv + // get the collection format (default: csv) + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // create the params based on the collection format - if (collectionFormat.equals("multi")) { + if ("multi".equals(format)) { for (Object item : valueCollection) { params.add(new Pair(name, parameterToString(item))); } @@ -369,13 +404,13 @@ public class ApiClient { String delimiter = ","; - if (collectionFormat.equals("csv")) { + if ("csv".equals(format)) { delimiter = ","; - } else if (collectionFormat.equals("ssv")) { + } else if ("ssv".equals(format)) { delimiter = " "; - } else if (collectionFormat.equals("tsv")) { + } else if ("tsv".equals(format)) { delimiter = "\t"; - } else if (collectionFormat.equals("pipes")) { + } else if ("pipes".equals(format)) { delimiter = "|"; } @@ -396,6 +431,8 @@ public class ApiClient { * application/json * application/json; charset=UTF8 * APPLICATION/JSON + * @param mime MIME + * @return True if the MIME type is JSON */ public boolean isJsonMime(String mime) { return mime != null && mime.matches("(?i)application\\/json(;.*)?"); @@ -445,6 +482,8 @@ public class ApiClient { /** * Escape the given string to be used as URL query value. + * @param str String + * @return Escaped string */ public String escapeString(String str) { try { @@ -457,9 +496,14 @@ public class ApiClient { /** * Serialize the given Java object into string entity according the given * Content-Type (only JSON is supported for now). + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return Entity + * @throws ApiException API exception */ public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { - Entity entity = null; + Entity entity; if (contentType.startsWith("multipart/form-data")) { MultiPart multiPart = new MultiPart(); for (Entry param: formParams.entrySet()) { @@ -489,7 +533,13 @@ public class ApiClient { /** * Deserialize response body to Java object according to the Content-Type. + * @param Type + * @param response Response + * @param returnType Return type + * @return Deserialize object + * @throws ApiException API exception */ + @SuppressWarnings("unchecked") public T deserialize(Response response, GenericType returnType) throws ApiException { if (response == null || returnType == null) { return null; @@ -498,9 +548,8 @@ public class ApiClient { if ("byte[]".equals(returnType.toString())) { // Handle binary response (byte array). return (T) response.readEntity(byte[].class); - } else if (returnType.equals(File.class)) { + } else if (returnType.getRawType() == File.class) { // Handle file downloading. - @SuppressWarnings("unchecked") T file = (T) downloadFileFromResponse(response); return file; } @@ -517,6 +566,8 @@ public class ApiClient { /** * Download file from the given response. + * @param response Response + * @return File * @throws ApiException If fail to read file content from response and write to disk */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -541,13 +592,13 @@ public class ApiClient { filename = matcher.group(1); } - String prefix = null; + String prefix; String suffix = null; if (filename == null) { prefix = "download-"; suffix = ""; } else { - int pos = filename.lastIndexOf("."); + int pos = filename.lastIndexOf('.'); if (pos == -1) { prefix = filename + "-"; } else { @@ -568,6 +619,7 @@ public class ApiClient { /** * Invoke API by sending HTTP request with the given options. * + * @param Type * @param path The sub-path of the HTTP URL * @param method The request method, one of "GET", "POST", "PUT", and "DELETE" * @param queryParams The query parameters @@ -579,6 +631,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param returnType The return type into which to deserialize the response * @return The response body in type of string + * @throws ApiException API exception */ public T invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType) throws ApiException { updateParamsForAuth(authNames, queryParams, headerParams); @@ -597,16 +650,17 @@ public class ApiClient { Invocation.Builder invocationBuilder = target.request().accept(accept); - for (String key : headerParams.keySet()) { - String value = headerParams.get(key); + for (Entry entry : headerParams.entrySet()) { + String value = entry.getValue(); if (value != null) { - invocationBuilder = invocationBuilder.header(key, value); + invocationBuilder = invocationBuilder.header(entry.getKey(), value); } } - for (String key : defaultHeaderMap.keySet()) { + for (Entry entry : defaultHeaderMap.entrySet()) { + String key = entry.getKey(); if (!headerParams.containsKey(key)) { - String value = defaultHeaderMap.get(key); + String value = entry.getValue(); if (value != null) { invocationBuilder = invocationBuilder.header(key, value); } @@ -615,7 +669,7 @@ public class ApiClient { Entity entity = serialize(body, formParams, contentType); - Response response = null; + Response response; if ("GET".equals(method)) { response = invocationBuilder.get(); @@ -625,6 +679,8 @@ public class ApiClient { response = invocationBuilder.put(entity); } else if ("DELETE".equals(method)) { response = invocationBuilder.delete(); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity); } else { throw new ApiException(500, "unknown method type " + method); } @@ -634,7 +690,7 @@ public class ApiClient { if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { return null; - } else if (response.getStatusInfo().getFamily().equals(Status.Family.SUCCESSFUL)) { + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { if (returnType == null) return null; else @@ -660,6 +716,8 @@ public class ApiClient { /** * Build the Client used to make HTTP requests. + * @param debugging Debug setting + * @return Client */ private Client buildHttpClient(boolean debugging) { final ClientConfig clientConfig = new ClientConfig(); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiException.java index 02a967d83730..d0b5cfc1e57e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiException.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Configuration.java index 57e53b2d5989..cbf868efb85c 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Configuration.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/JSON.java index 126fa1c856ac..562e2e13ea3a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/JSON.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/JSON.java @@ -25,6 +25,7 @@ public class JSON implements ContextResolver { /** * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format */ public void setDateFormat(DateFormat dateFormat) { mapper.setDateFormat(dateFormat); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Pair.java index 9ad2d2465199..b75cd316ac1d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Pair.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/RFC3339DateFormat.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/RFC3339DateFormat.java index d662f9457d7a..e8df24310aa6 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/RFC3339DateFormat.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/RFC3339DateFormat.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package io.swagger.client; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/StringUtil.java index 31140c76df4a..339a3fb36d5c 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/StringUtil.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java index 299cc5765af9..a8c2ebfa2b72 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java @@ -7,10 +7,10 @@ import io.swagger.client.Pair; import javax.ws.rs.core.GenericType; -import io.swagger.client.model.Client; -import org.joda.time.LocalDate; -import org.joda.time.DateTime; import java.math.BigDecimal; +import io.swagger.client.model.Client; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; import java.util.ArrayList; import java.util.HashMap; @@ -39,7 +39,7 @@ public class FakeApi { /** * To test \"client\" model - * + * To test \"client\" model * @param body client model (required) * @return Client * @throws ApiException if fails to make API call @@ -53,7 +53,7 @@ public class FakeApi { } // create path and map variables - String localVarPath = "/fake".replaceAll("\\{format\\}","json"); + String localVarPath = "/fake"; // query params List localVarQueryParams = new ArrayList(); @@ -121,7 +121,7 @@ public class FakeApi { } // create path and map variables - String localVarPath = "/fake".replaceAll("\\{format\\}","json"); + String localVarPath = "/fake"; // query params List localVarQueryParams = new ArrayList(); @@ -176,7 +176,7 @@ if (paramCallback != null) } /** * To test enum parameters - * + * To test enum parameters * @param enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @param enumHeaderStringArray Header parameter enum test (string array) (optional) @@ -187,11 +187,11 @@ if (paramCallback != null) * @param enumQueryDouble Query parameter enum test (double) (optional) * @throws ApiException if fails to make API call */ - public void testEnumParameters(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble) throws ApiException { + public void testEnumParameters(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble) throws ApiException { Object localVarPostBody = null; // create path and map variables - String localVarPath = "/fake".replaceAll("\\{format\\}","json"); + String localVarPath = "/fake"; // query params List localVarQueryParams = new ArrayList(); @@ -215,12 +215,12 @@ if (enumQueryDouble != null) localVarFormParams.put("enum_query_double", enumQueryDouble); final String[] localVarAccepts = { - "application/json" + "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - "application/json" + "*/*" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/PetApi.java index ab85c4ac3946..c8f8b730ca5b 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/PetApi.java @@ -7,9 +7,9 @@ import io.swagger.client.Pair; import javax.ws.rs.core.GenericType; -import io.swagger.client.model.Pet; import java.io.File; import io.swagger.client.model.ModelApiResponse; +import io.swagger.client.model.Pet; import java.util.ArrayList; import java.util.HashMap; @@ -51,7 +51,7 @@ public class PetApi { } // create path and map variables - String localVarPath = "/pet".replaceAll("\\{format\\}","json"); + String localVarPath = "/pet"; // query params List localVarQueryParams = new ArrayList(); @@ -92,7 +92,7 @@ public class PetApi { } // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + String localVarPath = "/pet/{petId}" .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params @@ -124,7 +124,7 @@ public class PetApi { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) - * @return List + * @return List<Pet> * @throws ApiException if fails to make API call */ public List findPetsByStatus(List status) throws ApiException { @@ -136,7 +136,7 @@ public class PetApi { } // create path and map variables - String localVarPath = "/pet/findByStatus".replaceAll("\\{format\\}","json"); + String localVarPath = "/pet/findByStatus"; // query params List localVarQueryParams = new ArrayList(); @@ -166,7 +166,7 @@ public class PetApi { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by (required) - * @return List + * @return List<Pet> * @throws ApiException if fails to make API call */ public List findPetsByTags(List tags) throws ApiException { @@ -178,7 +178,7 @@ public class PetApi { } // create path and map variables - String localVarPath = "/pet/findByTags".replaceAll("\\{format\\}","json"); + String localVarPath = "/pet/findByTags"; // query params List localVarQueryParams = new ArrayList(); @@ -220,7 +220,7 @@ public class PetApi { } // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + String localVarPath = "/pet/{petId}" .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params @@ -261,7 +261,7 @@ public class PetApi { } // create path and map variables - String localVarPath = "/pet".replaceAll("\\{format\\}","json"); + String localVarPath = "/pet"; // query params List localVarQueryParams = new ArrayList(); @@ -303,7 +303,7 @@ public class PetApi { } // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + String localVarPath = "/pet/{petId}" .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params @@ -351,7 +351,7 @@ if (status != null) } // create path and map variables - String localVarPath = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json") + String localVarPath = "/pet/{petId}/uploadImage" .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/StoreApi.java index c0c9a166ad72..d0a1e843743a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/StoreApi.java @@ -49,7 +49,7 @@ public class StoreApi { } // create path and map variables - String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") + String localVarPath = "/store/order/{orderId}" .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); // query params @@ -78,14 +78,14 @@ public class StoreApi { /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return Map + * @return Map<String, Integer> * @throws ApiException if fails to make API call */ public Map getInventory() throws ApiException { Object localVarPostBody = null; // create path and map variables - String localVarPath = "/store/inventory".replaceAll("\\{format\\}","json"); + String localVarPath = "/store/inventory"; // query params List localVarQueryParams = new ArrayList(); @@ -126,7 +126,7 @@ public class StoreApi { } // create path and map variables - String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") + String localVarPath = "/store/order/{orderId}" .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); // query params @@ -168,7 +168,7 @@ public class StoreApi { } // create path and map variables - String localVarPath = "/store/order".replaceAll("\\{format\\}","json"); + String localVarPath = "/store/order"; // query params List localVarQueryParams = new ArrayList(); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/UserApi.java index 7602f4e2ba94..a7dced63d855 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/UserApi.java @@ -49,7 +49,7 @@ public class UserApi { } // create path and map variables - String localVarPath = "/user".replaceAll("\\{format\\}","json"); + String localVarPath = "/user"; // query params List localVarQueryParams = new ArrayList(); @@ -89,7 +89,7 @@ public class UserApi { } // create path and map variables - String localVarPath = "/user/createWithArray".replaceAll("\\{format\\}","json"); + String localVarPath = "/user/createWithArray"; // query params List localVarQueryParams = new ArrayList(); @@ -129,7 +129,7 @@ public class UserApi { } // create path and map variables - String localVarPath = "/user/createWithList".replaceAll("\\{format\\}","json"); + String localVarPath = "/user/createWithList"; // query params List localVarQueryParams = new ArrayList(); @@ -169,7 +169,7 @@ public class UserApi { } // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + String localVarPath = "/user/{username}" .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); // query params @@ -211,7 +211,7 @@ public class UserApi { } // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + String localVarPath = "/user/{username}" .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); // query params @@ -259,7 +259,7 @@ public class UserApi { } // create path and map variables - String localVarPath = "/user/login".replaceAll("\\{format\\}","json"); + String localVarPath = "/user/login"; // query params List localVarQueryParams = new ArrayList(); @@ -295,7 +295,7 @@ public class UserApi { Object localVarPostBody = null; // create path and map variables - String localVarPath = "/user/logout".replaceAll("\\{format\\}","json"); + String localVarPath = "/user/logout"; // query params List localVarQueryParams = new ArrayList(); @@ -341,7 +341,7 @@ public class UserApi { } // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + String localVarPath = "/user/{username}" .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); // query params diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 0e0fdb63fb3e..5c6925473e5d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/Authentication.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/Authentication.java index 0ff06e3b86f7..e40d7ff70021 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/Authentication.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/Authentication.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index 420178c112d8..788b63a99183 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuth.java index c1b64913ab87..2d9dc9da8b50 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuth.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuthFlow.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuthFlow.java index 18c25738e0fe..b3718a0643cd 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index 9c7eefd81424..3ae66bbe6e4e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -59,7 +47,7 @@ public class AdditionalPropertiesClass { * Get mapProperty * @return mapProperty **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Map getMapProperty() { return mapProperty; } @@ -82,7 +70,7 @@ public class AdditionalPropertiesClass { * Get mapOfMapProperty * @return mapOfMapProperty **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Animal.java index 37322036a3b8..094faff9a338 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Animal.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -28,12 +16,19 @@ package io.swagger.client.model; import org.apache.commons.lang3.ObjectUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; /** * Animal */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true ) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), +}) public class Animal { @JsonProperty("className") @@ -51,7 +46,7 @@ public class Animal { * Get className * @return className **/ - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(required = true, value = "") public String getClassName() { return className; } @@ -69,7 +64,7 @@ public class Animal { * Get color * @return color **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getColor() { return color; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AnimalFarm.java index e8d42abef86c..ac4c22a76d72 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java index 865301853a55..01d49d0f2bd7 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -56,7 +44,7 @@ public class ArrayOfArrayOfNumberOnly { * Get arrayArrayNumber * @return arrayArrayNumber **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java index 13b18d821a8b..c8e64cfab200 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -56,7 +44,7 @@ public class ArrayOfNumberOnly { * Get arrayNumber * @return arrayNumber **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public List getArrayNumber() { return arrayNumber; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayTest.java index 8d76222e80ef..e82b4fe7c97d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayTest.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -62,7 +50,7 @@ public class ArrayTest { * Get arrayOfString * @return arrayOfString **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public List getArrayOfString() { return arrayOfString; } @@ -85,7 +73,7 @@ public class ArrayTest { * Get arrayArrayOfInteger * @return arrayArrayOfInteger **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -108,7 +96,7 @@ public class ArrayTest { * Get arrayArrayOfModel * @return arrayArrayOfModel **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Capitalization.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Capitalization.java new file mode 100644 index 000000000000..5f21318820d7 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Capitalization.java @@ -0,0 +1,204 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import org.apache.commons.lang3.ObjectUtils; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Capitalization + */ + +public class Capitalization { + @JsonProperty("smallCamel") + private String smallCamel = null; + + @JsonProperty("CapitalCamel") + private String capitalCamel = null; + + @JsonProperty("small_Snake") + private String smallSnake = null; + + @JsonProperty("Capital_Snake") + private String capitalSnake = null; + + @JsonProperty("SCA_ETH_Flow_Points") + private String scAETHFlowPoints = null; + + @JsonProperty("ATT_NAME") + private String ATT_NAME = null; + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @ApiModelProperty(value = "") + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @ApiModelProperty(value = "") + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @ApiModelProperty(value = "") + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @ApiModelProperty(value = "") + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @ApiModelProperty(value = "") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @ApiModelProperty(value = "Name of the pet ") + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return ObjectUtils.equals(this.smallCamel, capitalization.smallCamel) && + ObjectUtils.equals(this.capitalCamel, capitalization.capitalCamel) && + ObjectUtils.equals(this.smallSnake, capitalization.smallSnake) && + ObjectUtils.equals(this.capitalSnake, capitalization.capitalSnake) && + ObjectUtils.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + ObjectUtils.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return ObjectUtils.hashCodeMulti(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Cat.java index 67da93eaf5ab..9810941ab3c0 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Cat.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -49,7 +37,7 @@ public class Cat extends Animal { * Get declawed * @return declawed **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Boolean getDeclawed() { return declawed; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Category.java index 65e7653b4e26..bab0deb78a6e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Category.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -51,7 +39,7 @@ public class Category { * Get id * @return id **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Long getId() { return id; } @@ -69,7 +57,7 @@ public class Category { * Get name * @return name **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ClassModel.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ClassModel.java new file mode 100644 index 000000000000..e83dfe06b544 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ClassModel.java @@ -0,0 +1,90 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import org.apache.commons.lang3.ObjectUtils; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") + +public class ClassModel { + @JsonProperty("_class") + private String propertyClass = null; + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return ObjectUtils.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return ObjectUtils.hashCodeMulti(propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Client.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Client.java index 7236cb848d9b..94b55364ae16 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Client.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Client.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -48,7 +36,7 @@ public class Client { * Get client * @return client **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getClient() { return client; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Dog.java index 83cf2efd7308..86f53267ca45 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Dog.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -49,7 +37,7 @@ public class Dog extends Animal { * Get breed * @return breed **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getBreed() { return breed; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumArrays.java index b91b2f9e8b0e..ebcbce243dd2 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumArrays.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -113,7 +101,7 @@ public class EnumArrays { * Get justSymbol * @return justSymbol **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -136,7 +124,7 @@ public class EnumArrays { * Get arrayEnum * @return arrayEnum **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public List getArrayEnum() { return arrayEnum; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumClass.java index 39a75ac97f4e..1732c2f241df 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumClass.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumTest.java index efa77302887d..d1e298d66255 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumTest.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -30,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.OuterEnum; /** * EnumTest @@ -137,6 +126,9 @@ public class EnumTest { @JsonProperty("enum_number") private EnumNumberEnum enumNumber = null; + @JsonProperty("outerEnum") + private OuterEnum outerEnum = null; + public EnumTest enumString(EnumStringEnum enumString) { this.enumString = enumString; return this; @@ -146,7 +138,7 @@ public class EnumTest { * Get enumString * @return enumString **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public EnumStringEnum getEnumString() { return enumString; } @@ -164,7 +156,7 @@ public class EnumTest { * Get enumInteger * @return enumInteger **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -182,7 +174,7 @@ public class EnumTest { * Get enumNumber * @return enumNumber **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -191,6 +183,24 @@ public class EnumTest { this.enumNumber = enumNumber; } + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @ApiModelProperty(value = "") + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + @Override public boolean equals(java.lang.Object o) { @@ -203,12 +213,13 @@ public class EnumTest { EnumTest enumTest = (EnumTest) o; return ObjectUtils.equals(this.enumString, enumTest.enumString) && ObjectUtils.equals(this.enumInteger, enumTest.enumInteger) && - ObjectUtils.equals(this.enumNumber, enumTest.enumNumber); + ObjectUtils.equals(this.enumNumber, enumTest.enumNumber) && + ObjectUtils.equals(this.outerEnum, enumTest.outerEnum); } @Override public int hashCode() { - return ObjectUtils.hashCodeMulti(enumString, enumInteger, enumNumber); + return ObjectUtils.hashCodeMulti(enumString, enumInteger, enumNumber, outerEnum); } @@ -220,6 +231,7 @@ public class EnumTest { sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/FormatTest.java index 871c46a1d4d7..e530b8360c8a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/FormatTest.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -31,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; +import java.util.UUID; import org.joda.time.DateTime; import org.joda.time.LocalDate; @@ -73,7 +62,7 @@ public class FormatTest { private DateTime dateTime = null; @JsonProperty("uuid") - private String uuid = null; + private UUID uuid = null; @JsonProperty("password") private String password = null; @@ -85,11 +74,11 @@ public class FormatTest { /** * Get integer - * minimum: 10.0 - * maximum: 100.0 + * minimum: 10 + * maximum: 100 * @return integer **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Integer getInteger() { return integer; } @@ -105,11 +94,11 @@ public class FormatTest { /** * Get int32 - * minimum: 20.0 - * maximum: 200.0 + * minimum: 20 + * maximum: 200 * @return int32 **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Integer getInt32() { return int32; } @@ -127,7 +116,7 @@ public class FormatTest { * Get int64 * @return int64 **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Long getInt64() { return int64; } @@ -147,7 +136,7 @@ public class FormatTest { * maximum: 543.2 * @return number **/ - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(required = true, value = "") public BigDecimal getNumber() { return number; } @@ -167,7 +156,7 @@ public class FormatTest { * maximum: 987.6 * @return _float **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Float getFloat() { return _float; } @@ -187,7 +176,7 @@ public class FormatTest { * maximum: 123.4 * @return _double **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Double getDouble() { return _double; } @@ -205,7 +194,7 @@ public class FormatTest { * Get string * @return string **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getString() { return string; } @@ -223,7 +212,7 @@ public class FormatTest { * Get _byte * @return _byte **/ - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(required = true, value = "") public byte[] getByte() { return _byte; } @@ -241,7 +230,7 @@ public class FormatTest { * Get binary * @return binary **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public byte[] getBinary() { return binary; } @@ -259,7 +248,7 @@ public class FormatTest { * Get date * @return date **/ - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(required = true, value = "") public LocalDate getDate() { return date; } @@ -277,7 +266,7 @@ public class FormatTest { * Get dateTime * @return dateTime **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public DateTime getDateTime() { return dateTime; } @@ -286,7 +275,7 @@ public class FormatTest { this.dateTime = dateTime; } - public FormatTest uuid(String uuid) { + public FormatTest uuid(UUID uuid) { this.uuid = uuid; return this; } @@ -295,12 +284,12 @@ public class FormatTest { * Get uuid * @return uuid **/ - @ApiModelProperty(example = "null", value = "") - public String getUuid() { + @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } - public void setUuid(String uuid) { + public void setUuid(UUID uuid) { this.uuid = uuid; } @@ -313,7 +302,7 @@ public class FormatTest { * Get password * @return password **/ - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(required = true, value = "") public String getPassword() { return password; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java index 61a27927a455..85a2b788ef05 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -46,7 +34,7 @@ public class HasOnlyReadOnly { * Get bar * @return bar **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getBar() { return bar; } @@ -55,7 +43,7 @@ public class HasOnlyReadOnly { * Get foo * @return foo **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getFoo() { return foo; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MapTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MapTest.java index 94c5805a2351..61b09c151d6b 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MapTest.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -89,7 +77,7 @@ public class MapTest { * Get mapMapOfString * @return mapMapOfString **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Map> getMapMapOfString() { return mapMapOfString; } @@ -112,7 +100,7 @@ public class MapTest { * Get mapOfEnumString * @return mapOfEnumString **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index bf3fbe4876c7..f7458c793a83 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -34,6 +22,7 @@ import io.swagger.client.model.Animal; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import org.joda.time.DateTime; /** @@ -42,7 +31,7 @@ import org.joda.time.DateTime; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private String uuid = null; + private UUID uuid = null; @JsonProperty("dateTime") private DateTime dateTime = null; @@ -50,7 +39,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("map") private Map map = new HashMap(); - public MixedPropertiesAndAdditionalPropertiesClass uuid(String uuid) { + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { this.uuid = uuid; return this; } @@ -59,12 +48,12 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * Get uuid * @return uuid **/ - @ApiModelProperty(example = "null", value = "") - public String getUuid() { + @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } - public void setUuid(String uuid) { + public void setUuid(UUID uuid) { this.uuid = uuid; } @@ -77,7 +66,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * Get dateTime * @return dateTime **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public DateTime getDateTime() { return dateTime; } @@ -100,7 +89,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * Get map * @return map **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Map getMap() { return map; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Model200Response.java index ee1c0b84b3e4..03dc410f058b 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Model200Response.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -52,7 +40,7 @@ public class Model200Response { * Get name * @return name **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Integer getName() { return name; } @@ -70,7 +58,7 @@ public class Model200Response { * Get propertyClass * @return propertyClass **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getPropertyClass() { return propertyClass; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelApiResponse.java index f297c62d02a1..daa1f75b5c7c 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -54,7 +42,7 @@ public class ModelApiResponse { * Get code * @return code **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Integer getCode() { return code; } @@ -72,7 +60,7 @@ public class ModelApiResponse { * Get type * @return type **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getType() { return type; } @@ -90,7 +78,7 @@ public class ModelApiResponse { * Get message * @return message **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getMessage() { return message; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelReturn.java index 6b1651ea3522..299742d50f2d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelReturn.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -49,7 +37,7 @@ public class ModelReturn { * Get _return * @return _return **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Integer getReturn() { return _return; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Name.java index 72338ad60ead..ff901a298a6f 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Name.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -58,7 +46,7 @@ public class Name { * Get name * @return name **/ - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(required = true, value = "") public Integer getName() { return name; } @@ -71,7 +59,7 @@ public class Name { * Get snakeCase * @return snakeCase **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Integer getSnakeCase() { return snakeCase; } @@ -85,7 +73,7 @@ public class Name { * Get property * @return property **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getProperty() { return property; } @@ -98,7 +86,7 @@ public class Name { * Get _123Number * @return _123Number **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Integer get123Number() { return _123Number; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/NumberOnly.java index 2a96764e4c6b..75b2331d52ba 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/NumberOnly.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -49,7 +37,7 @@ public class NumberOnly { * Get justNumber * @return justNumber **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Order.java index 1a72afa5da38..30648dbb7ffd 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Order.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -96,7 +84,7 @@ public class Order { * Get id * @return id **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Long getId() { return id; } @@ -114,7 +102,7 @@ public class Order { * Get petId * @return petId **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Long getPetId() { return petId; } @@ -132,7 +120,7 @@ public class Order { * Get quantity * @return quantity **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Integer getQuantity() { return quantity; } @@ -150,7 +138,7 @@ public class Order { * Get shipDate * @return shipDate **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public DateTime getShipDate() { return shipDate; } @@ -168,7 +156,7 @@ public class Order { * Order Status * @return status **/ - @ApiModelProperty(example = "null", value = "Order Status") + @ApiModelProperty(value = "Order Status") public StatusEnum getStatus() { return status; } @@ -186,7 +174,7 @@ public class Order { * Get complete * @return complete **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Boolean getComplete() { return complete; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/OuterEnum.java new file mode 100644 index 000000000000..75577d614341 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/OuterEnum.java @@ -0,0 +1,52 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import org.apache.commons.lang3.ObjectUtils; + +import com.fasterxml.jackson.annotation.JsonCreator; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String text) { + for (OuterEnum b : OuterEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Pet.java index 5afa9425acf0..aad6032fca5d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Pet.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -99,7 +87,7 @@ public class Pet { * Get id * @return id **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Long getId() { return id; } @@ -117,7 +105,7 @@ public class Pet { * Get category * @return category **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Category getCategory() { return category; } @@ -158,7 +146,7 @@ public class Pet { * Get photoUrls * @return photoUrls **/ - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(required = true, value = "") public List getPhotoUrls() { return photoUrls; } @@ -181,7 +169,7 @@ public class Pet { * Get tags * @return tags **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public List getTags() { return tags; } @@ -199,7 +187,7 @@ public class Pet { * pet status in the store * @return status **/ - @ApiModelProperty(example = "null", value = "pet status in the store") + @ApiModelProperty(value = "pet status in the store") public StatusEnum getStatus() { return status; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index 7e50551c137c..5aa0e9275a2b 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -46,7 +34,7 @@ public class ReadOnlyFirst { * Get bar * @return bar **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getBar() { return bar; } @@ -60,7 +48,7 @@ public class ReadOnlyFirst { * Get baz * @return baz **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getBaz() { return baz; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/SpecialModelName.java index 3fad665435cc..527fc647eafa 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -48,7 +36,7 @@ public class SpecialModelName { * Get specialPropertyName * @return specialPropertyName **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Tag.java index 4109837bb895..94764acde854 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Tag.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -51,7 +39,7 @@ public class Tag { * Get id * @return id **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Long getId() { return id; } @@ -69,7 +57,7 @@ public class Tag { * Get name * @return name **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getName() { return name; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/User.java index 9333959c881d..5bedd26f2729 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/User.java @@ -8,18 +8,6 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -69,7 +57,7 @@ public class User { * Get id * @return id **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public Long getId() { return id; } @@ -87,7 +75,7 @@ public class User { * Get username * @return username **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getUsername() { return username; } @@ -105,7 +93,7 @@ public class User { * Get firstName * @return firstName **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getFirstName() { return firstName; } @@ -123,7 +111,7 @@ public class User { * Get lastName * @return lastName **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getLastName() { return lastName; } @@ -141,7 +129,7 @@ public class User { * Get email * @return email **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getEmail() { return email; } @@ -159,7 +147,7 @@ public class User { * Get password * @return password **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getPassword() { return password; } @@ -177,7 +165,7 @@ public class User { * Get phone * @return phone **/ - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") public String getPhone() { return phone; } @@ -195,7 +183,7 @@ public class User { * User Status * @return userStatus **/ - @ApiModelProperty(example = "null", value = "User Status") + @ApiModelProperty(value = "User Status") public Integer getUserStatus() { return userStatus; } From 43aa4a8569a11a803fce8bf536dd916d0c4f6fc6 Mon Sep 17 00:00:00 2001 From: jfiala Date: Thu, 23 Mar 2017 08:56:23 +0100 Subject: [PATCH 6/6] [Jaxrs-cxf] Add method-level cascaded beanvalidation (@Valid) (#4921) * add ApiResponse/s to operation #4718 * add method-level cascaded beanvalidation #4847 --- .../main/resources/JavaJaxRS/cxf/api.mustache | 1 + .../JavaJaxRS/cxf/apiServiceImpl.mustache | 2 +- .../resources/JavaJaxRS/cxf/bodyParams.mustache | 2 +- .../JavaJaxRS/cxf/bodyParamsImpl.mustache | 1 + .../src/gen/java/io/swagger/api/FakeApi.java | 3 ++- .../src/gen/java/io/swagger/api/PetApi.java | 5 +++-- .../src/gen/java/io/swagger/api/StoreApi.java | 3 ++- .../src/gen/java/io/swagger/api/UserApi.java | 9 +++++---- .../src/test/java/io/swagger/api/PetApiTest.java | 12 ++++++------ .../test/java/io/swagger/api/StoreApiTest.java | 6 +++--- .../test/java/io/swagger/api/UserApiTest.java | 16 ++++++++-------- 11 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/bodyParamsImpl.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache index 19a5938c843a..bcaedef14b3a 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache @@ -19,6 +19,7 @@ import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; {{#useBeanValidation}} import javax.validation.constraints.*; +import javax.validation.Valid; {{/useBeanValidation}} @Path("{{^useAnnotatedBasePath}}/{{/useAnnotatedBasePath}}{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}") diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache index 70f5f4f37ded..ea21a5635c10 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache @@ -28,7 +28,7 @@ import org.springframework.stereotype.Service; public class {{classname}}ServiceImpl implements {{classname}} { {{#operations}} {{#operation}} - public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParams}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { + public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParamsImpl}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { // TODO: Implement... {{^vendorExtensions.x-java-is-response-void}}return null;{{/vendorExtensions.x-java-is-response-void}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/bodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/bodyParams.mustache index c7d1abfe527e..be56da7535be 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/bodyParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/bodyParams.mustache @@ -1 +1 @@ -{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file +{{#isBodyParam}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/bodyParamsImpl.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/bodyParamsImpl.mustache new file mode 100644 index 000000000000..c7d1abfe527e --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/bodyParamsImpl.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeApi.java index 4059c84a6229..b91184bbad3c 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeApi.java @@ -19,6 +19,7 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/") @Api(value = "/", description = "") @@ -31,7 +32,7 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Client testClientModel(Client body); + public Client testClientModel(@Valid Client body); @POST @Path("/fake") diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/PetApi.java index 68701e28cc29..93a82ed4f6c8 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/PetApi.java @@ -19,6 +19,7 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/") @Api(value = "/", description = "") @@ -31,7 +32,7 @@ public interface PetApi { @ApiOperation(value = "Add a new pet to the store", tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input") }) - public void addPet(Pet body); + public void addPet(@Valid Pet body); @DELETE @Path("/pet/{petId}") @@ -78,7 +79,7 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Pet not found"), @ApiResponse(code = 405, message = "Validation exception") }) - public void updatePet(Pet body); + public void updatePet(@Valid Pet body); @POST @Path("/pet/{petId}") diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/StoreApi.java index f6f1b34c2436..8ddeb8f3deab 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/StoreApi.java @@ -18,6 +18,7 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/") @Api(value = "/", description = "") @@ -57,6 +58,6 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order") }) - public Order placeOrder(Order body); + public Order placeOrder(@Valid Order body); } diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/UserApi.java index 172b6938f1d2..4b12da15c8ec 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/UserApi.java @@ -18,6 +18,7 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/") @Api(value = "/", description = "") @@ -29,7 +30,7 @@ public interface UserApi { @ApiOperation(value = "Create user", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) - public void createUser(User body); + public void createUser(@Valid User body); @POST @Path("/user/createWithArray") @@ -37,7 +38,7 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) - public void createUsersWithArrayInput(List body); + public void createUsersWithArrayInput(@Valid List body); @POST @Path("/user/createWithList") @@ -45,7 +46,7 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) - public void createUsersWithListInput(List body); + public void createUsersWithListInput(@Valid List body); @DELETE @Path("/user/{username}") @@ -90,6 +91,6 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), @ApiResponse(code = 404, message = "User not found") }) - public void updateUser(@PathParam("username") String username, User body); + public void updateUser(@Valid @PathParam("username") String username, User body); } diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/PetApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/PetApiTest.java index 188fdb7b5cf7..444c595b78e0 100644 --- a/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/PetApiTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/PetApiTest.java @@ -80,7 +80,7 @@ public class PetApiTest { @Test public void addPetTest() { Pet body = null; - //api.addPet(body); + //api.addPet(body); // TODO: test validations @@ -99,7 +99,7 @@ public class PetApiTest { public void deletePetTest() { Long petId = null; String apiKey = null; - //api.deletePet(petId, apiKey); + //api.deletePet(petId, apiKey); // TODO: test validations @@ -153,7 +153,7 @@ public class PetApiTest { @Test public void getPetByIdTest() { Long petId = null; - //Pet response = api.getPetById(petId); + //Pet response = api.getPetById(petId); //assertNotNull(response); // TODO: test validations @@ -171,7 +171,7 @@ public class PetApiTest { @Test public void updatePetTest() { Pet body = null; - //api.updatePet(body); + //api.updatePet(body); // TODO: test validations @@ -191,7 +191,7 @@ public class PetApiTest { Long petId = null; String name = null; String status = null; - //api.updatePetWithForm(petId, name, status); + //api.updatePetWithForm(petId, name, status); // TODO: test validations @@ -211,7 +211,7 @@ public class PetApiTest { Long petId = null; String additionalMetadata = null; org.apache.cxf.jaxrs.ext.multipart.Attachment file = null; - //ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + //ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); //assertNotNull(response); // TODO: test validations diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/StoreApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/StoreApiTest.java index aa476b0cf0ff..c0cd10dca719 100644 --- a/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/StoreApiTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/StoreApiTest.java @@ -79,7 +79,7 @@ public class StoreApiTest { @Test public void deleteOrderTest() { String orderId = null; - //api.deleteOrder(orderId); + //api.deleteOrder(orderId); // TODO: test validations @@ -114,7 +114,7 @@ public class StoreApiTest { @Test public void getOrderByIdTest() { Long orderId = null; - //Order response = api.getOrderById(orderId); + //Order response = api.getOrderById(orderId); //assertNotNull(response); // TODO: test validations @@ -132,7 +132,7 @@ public class StoreApiTest { @Test public void placeOrderTest() { Order body = null; - //Order response = api.placeOrder(body); + //Order response = api.placeOrder(body); //assertNotNull(response); // TODO: test validations diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/UserApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/UserApiTest.java index 76bb7fa55782..2d1481bde34f 100644 --- a/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/UserApiTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/UserApiTest.java @@ -79,7 +79,7 @@ public class UserApiTest { @Test public void createUserTest() { User body = null; - //api.createUser(body); + //api.createUser(body); // TODO: test validations @@ -97,7 +97,7 @@ public class UserApiTest { @Test public void createUsersWithArrayInputTest() { List body = null; - //api.createUsersWithArrayInput(body); + //api.createUsersWithArrayInput(body); // TODO: test validations @@ -115,7 +115,7 @@ public class UserApiTest { @Test public void createUsersWithListInputTest() { List body = null; - //api.createUsersWithListInput(body); + //api.createUsersWithListInput(body); // TODO: test validations @@ -133,7 +133,7 @@ public class UserApiTest { @Test public void deleteUserTest() { String username = null; - //api.deleteUser(username); + //api.deleteUser(username); // TODO: test validations @@ -151,7 +151,7 @@ public class UserApiTest { @Test public void getUserByNameTest() { String username = null; - //User response = api.getUserByName(username); + //User response = api.getUserByName(username); //assertNotNull(response); // TODO: test validations @@ -170,7 +170,7 @@ public class UserApiTest { public void loginUserTest() { String username = null; String password = null; - //String response = api.loginUser(username, password); + //String response = api.loginUser(username, password); //assertNotNull(response); // TODO: test validations @@ -187,7 +187,7 @@ public class UserApiTest { */ @Test public void logoutUserTest() { - //api.logoutUser(); + //api.logoutUser(); // TODO: test validations @@ -206,7 +206,7 @@ public class UserApiTest { public void updateUserTest() { String username = null; User body = null; - //api.updateUser(username, body); + //api.updateUser(username, body); // TODO: test validations