From 694c9a96c145d5c72960ce608c434ce2a1982d12 Mon Sep 17 00:00:00 2001 From: Ben Mordue Date: Mon, 22 Jan 2018 16:00:33 +0000 Subject: [PATCH 1/2] new Object() for empty request body --- modules/swagger-codegen/src/main/resources/Java/api.mustache | 2 +- .../src/main/resources/Java/libraries/jersey2/api.mustache | 2 +- .../src/main/resources/Java/libraries/okhttp-gson/api.mustache | 2 +- .../src/main/resources/Java/libraries/resteasy/api.mustache | 2 +- .../src/main/resources/Java/libraries/resttemplate/api.mustache | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/api.mustache b/modules/swagger-codegen/src/main/resources/Java/api.mustache index 542ccbba287..383c310e579 100644 --- a/modules/swagger-codegen/src/main/resources/Java/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/api.mustache @@ -64,7 +64,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/api.mustache index fed034609c8..17f27e94a3d 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/api.mustache @@ -91,7 +91,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache index ffc68bc7b5a..f6ab4d05e45 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -82,7 +82,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public com.squareup.okhttp.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}}; // create path and map variables String {{localVariablePrefix}}localVarPath = "{{{path}}}"{{#pathParams}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/resteasy/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/resteasy/api.mustache index f3fd01ed61b..bd70d88a2dd 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/resteasy/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/resteasy/api.mustache @@ -57,7 +57,7 @@ public class {{classname}} { @Deprecated {{/isDeprecated}} public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/api.mustache index f48180f4381..a906a80e7a8 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/resttemplate/api.mustache @@ -61,7 +61,7 @@ public class {{classname}} { {{/externalDocs}} */ public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException { - Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { From b15efea977d81801d58b5fbd3e913d1085c2c5f5 Mon Sep 17 00:00:00 2001 From: Ben Mordue Date: Tue, 15 May 2018 20:24:05 +0100 Subject: [PATCH 2/2] Ran bin/java-petstore-all.sh --- .../java/io/swagger/client/api/FakeApi.java | 47 ++++++ .../io/swagger/client/model/EnumTest.java | 62 +++++++- .../java/google-api-client/docs/EnumTest.md | 10 ++ .../java/google-api-client/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 118 +++++++++++++++ .../io/swagger/client/model/EnumTest.java | 62 +++++++- .../client/petstore/java/jersey1/build.gradle | 19 ++- .../petstore/java/jersey1/docs/EnumTest.md | 10 ++ .../petstore/java/jersey1/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 55 ++++++- .../java/io/swagger/client/api/PetApi.java | 12 +- .../java/io/swagger/client/api/StoreApi.java | 6 +- .../java/io/swagger/client/api/UserApi.java | 8 +- .../io/swagger/client/model/EnumTest.java | 62 +++++++- .../java/jersey2-java6/docs/EnumTest.md | 10 ++ .../java/jersey2-java6/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 60 ++++++++ .../io/swagger/client/model/EnumTest.java | 62 +++++++- .../java/jersey2-java8/docs/EnumTest.md | 10 ++ .../java/jersey2-java8/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 60 ++++++++ .../io/swagger/client/model/EnumTest.java | 62 +++++++- .../petstore/java/jersey2/docs/EnumTest.md | 10 ++ .../petstore/java/jersey2/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 60 ++++++++ .../io/swagger/client/model/EnumTest.java | 62 +++++++- .../docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 136 +++++++++++++++++- .../java/io/swagger/client/api/PetApi.java | 12 +- .../java/io/swagger/client/api/StoreApi.java | 6 +- .../java/io/swagger/client/api/UserApi.java | 8 +- .../java/okhttp-gson/docs/EnumTest.md | 10 ++ .../petstore/java/okhttp-gson/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 136 +++++++++++++++++- .../java/io/swagger/client/api/PetApi.java | 12 +- .../java/io/swagger/client/api/StoreApi.java | 6 +- .../java/io/swagger/client/api/UserApi.java | 8 +- .../io/swagger/client/model/EnumTest.java | 74 +++++++++- .../io/swagger/client/api/AnotherFakeApi.java | 12 +- .../client/api/FakeClassnameTags123Api.java | 12 +- .../java/io/swagger/client/api/PetApi.java | 20 +-- .../java/io/swagger/client/api/StoreApi.java | 15 +- .../java/io/swagger/client/api/UserApi.java | 16 ++- .../io/swagger/client/model/EnumTest.java | 6 +- .../petstore/java/resteasy/docs/EnumTest.md | 10 ++ .../petstore/java/resteasy/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 48 +++++++ .../io/swagger/client/model/EnumTest.java | 62 +++++++- .../resttemplate-withXml/docs/EnumTest.md | 10 ++ .../java/resttemplate-withXml/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 42 ++++++ .../io/swagger/client/model/EnumTest.java | 64 ++++++++- .../java/resttemplate/docs/EnumTest.md | 10 ++ .../java/resttemplate/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 42 ++++++ .../io/swagger/client/model/EnumTest.java | 62 +++++++- .../java/io/swagger/client/api/FakeApi.java | 27 ++++ .../io/swagger/client/model/EnumTest.java | 74 +++++++++- .../java/retrofit2-play24/docs/EnumTest.md | 10 ++ .../java/retrofit2-play24/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 16 +++ .../io/swagger/client/model/EnumTest.java | 63 +++++++- .../petstore/java/retrofit2/docs/EnumTest.md | 10 ++ .../petstore/java/retrofit2/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 16 +++ .../io/swagger/client/model/EnumTest.java | 74 +++++++++- .../java/retrofit2rx/docs/EnumTest.md | 10 ++ .../petstore/java/retrofit2rx/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 16 +++ .../io/swagger/client/model/EnumTest.java | 74 +++++++++- .../java/retrofit2rx2/docs/EnumTest.md | 10 ++ .../java/retrofit2rx2/docs/FakeApi.md | 45 ++++++ .../java/io/swagger/client/api/FakeApi.java | 16 +++ .../io/swagger/client/model/EnumTest.java | 74 +++++++++- 74 files changed, 2736 insertions(+), 90 deletions(-) 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 613e8a22fe6..0067add2abe 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 @@ -8,6 +8,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -71,6 +72,52 @@ public interface FakeApi extends ApiClient.Api { }) String fakeOuterStringSerialize(String body); + /** + * + * + * @param body (required) + * @param query (required) + */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + void testBodyWithQueryParams(User body, @Param("query") String query); + + /** + * + * + * Note, this is equivalent to the other testBodyWithQueryParams 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 TestBodyWithQueryParamsQueryParams} class that allows for + * building up this map in a fluent style. + * @param body (required) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ * + */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + void testBodyWithQueryParams(User body, @QueryMap(encoded=true) Map queryParams); + + /** + * A convenience class for generating query parameters for the + * testBodyWithQueryParams method in a fluent style. + */ + public static class TestBodyWithQueryParamsQueryParams extends HashMap { + public TestBodyWithQueryParamsQueryParams query(final String value) { + put("query", EncodingUtils.encode(value)); + return this; + } + } + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java index 193d7f101db..2bb7dd17d43 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java @@ -67,6 +67,46 @@ public static EnumStringEnum fromValue(String text) { @JsonProperty("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -164,6 +204,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -229,6 +287,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -236,7 +295,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -246,6 +305,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/google-api-client/docs/EnumTest.md b/samples/client/petstore/java/google-api-client/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/google-api-client/docs/EnumTest.md +++ b/samples/client/petstore/java/google-api-client/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/google-api-client/docs/FakeApi.md b/samples/client/petstore/java/google-api-client/docs/FakeApi.md index 737ccc28293..05286676681 100644 --- a/samples/client/petstore/java/google-api-client/docs/FakeApi.md +++ b/samples/client/petstore/java/google-api-client/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/google-api-client/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/google-api-client/src/main/java/io/swagger/client/api/FakeApi.java index 013833c1181..498781d39b1 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/io/swagger/client/api/FakeApi.java @@ -7,6 +7,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import com.fasterxml.jackson.core.type.TypeReference; import com.google.api.client.http.GenericUrl; @@ -364,6 +365,123 @@ public HttpResponse fakeOuterStringSerializeForHttpResponse(String body, Map200 - Success + * @param body The body parameter + * @param query The query parameter + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void testBodyWithQueryParams(User body, String query) throws IOException { + testBodyWithQueryParamsForHttpResponse(body, query); + } + + /** + *

200 - Success + * @param body The body parameter + * @param query The query parameter + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @throws IOException if an error occurs while attempting to invoke the API + **/ + public void testBodyWithQueryParams(User body, String query, Map params) throws IOException { + testBodyWithQueryParamsForHttpResponse(body, query, params); + } + + public HttpResponse testBodyWithQueryParamsForHttpResponse(User body, String query) throws IOException { + // verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling testBodyWithQueryParams"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/body-with-query-params"); + if (query != null) { + String key = "query"; + Object value = query; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse testBodyWithQueryParamsForHttpResponse(java.io.InputStream body, String query, String mediaType) throws IOException { + // verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling testBodyWithQueryParams"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/body-with-query-params"); + if (query != null) { + String key = "query"; + Object value = query; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = body == null ? + apiClient.new JacksonJsonHttpContent(null) : + new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + public HttpResponse testBodyWithQueryParamsForHttpResponse(User body, String query, Map params) throws IOException { + // verify the required parameter 'body' is set + if (body == null) { + throw new IllegalArgumentException("Missing the required parameter 'body' when calling testBodyWithQueryParams"); + }// verify the required parameter 'query' is set + if (query == null) { + throw new IllegalArgumentException("Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/body-with-query-params"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'query' to the map of query params + allParams.put("query", query); + + for (Map.Entry entry: allParams.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = apiClient.new JacksonJsonHttpContent(body); + return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); + } + + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/google-api-client/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/google-api-client/src/main/java/io/swagger/client/model/EnumTest.java index 193d7f101db..2bb7dd17d43 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/io/swagger/client/model/EnumTest.java @@ -67,6 +67,46 @@ public static EnumStringEnum fromValue(String text) { @JsonProperty("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -164,6 +204,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -229,6 +287,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -236,7 +295,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -246,6 +305,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/jersey1/build.gradle b/samples/client/petstore/java/jersey1/build.gradle index e9643f8935c..9f3bb3cb70b 100644 --- a/samples/client/petstore/java/jersey1/build.gradle +++ b/samples/client/petstore/java/jersey1/build.gradle @@ -18,7 +18,6 @@ repositories { jcenter() } - if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -91,6 +90,21 @@ if(hasProperty('target') && target == 'android') { main = System.getProperty('mainClass') classpath = sourceSets.main.runtimeClasspath } + + task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource + } + + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } + + artifacts { + archives sourcesJar + archives javadocJar + } } ext { @@ -109,7 +123,8 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" - compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version", + compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version" compile "com.brsanthu:migbase64:2.2" testCompile "junit:junit:$junit_version" } + diff --git a/samples/client/petstore/java/jersey1/docs/EnumTest.md b/samples/client/petstore/java/jersey1/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/jersey1/docs/EnumTest.md +++ b/samples/client/petstore/java/jersey1/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/jersey1/docs/FakeApi.md b/samples/client/petstore/java/jersey1/docs/FakeApi.md index 737ccc28293..05286676681 100644 --- a/samples/client/petstore/java/jersey1/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey1/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeApi.java index 267fd5c8bda..27fd92085f2 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeApi.java @@ -25,6 +25,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; @@ -200,6 +201,54 @@ public String fakeOuterStringSerialize(String body) throws ApiException { GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + /** + * + * + * @param body (required) + * @param query (required) + * @throws ApiException if fails to make API call + */ + public void testBodyWithQueryParams(User body, String query) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + } + + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + // query params + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPair("query", query)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } /** * To test \"client\" model * To test \"client\" model @@ -262,7 +311,7 @@ public Client testClientModel(Client body) throws ApiException { * @throws ApiException if fails to make API call */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'number' is set if (number == null) { @@ -353,7 +402,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @throws ApiException if fails to make API call */ public void testEnumParameters(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -444,7 +493,7 @@ public void testInlineAdditionalProperties(Object param) throws ApiException { * @throws ApiException if fails to make API call */ public void testJsonFormData(String param, String param2) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'param' is set if (param == null) { diff --git a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/PetApi.java index edd3fb24885..3184b3dace8 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/PetApi.java @@ -99,7 +99,7 @@ public void addPet(Pet body) throws ApiException { * @throws ApiException if fails to make API call */ public void deletePet(Long petId, String apiKey) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -144,7 +144,7 @@ public void deletePet(Long petId, String apiKey) throws ApiException { * @throws ApiException if fails to make API call */ public List findPetsByStatus(List status) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'status' is set if (status == null) { @@ -189,7 +189,7 @@ public List findPetsByStatus(List status) throws ApiException { */ @Deprecated public List findPetsByTags(List tags) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'tags' is set if (tags == null) { @@ -232,7 +232,7 @@ public List findPetsByTags(List tags) throws ApiException { * @throws ApiException if fails to make API call */ public Pet getPetById(Long petId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -317,7 +317,7 @@ public void updatePet(Pet body) throws ApiException { * @throws ApiException if fails to make API call */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { @@ -366,7 +366,7 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api * @throws ApiException if fails to make API call */ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'petId' is set if (petId == null) { diff --git a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/StoreApi.java index 0c8a68f5d21..d316c9dc498 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/StoreApi.java @@ -55,7 +55,7 @@ public void setApiClient(ApiClient apiClient) { * @throws ApiException if fails to make API call */ public void deleteOrder(String orderId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { @@ -97,7 +97,7 @@ public void deleteOrder(String orderId) throws ApiException { * @throws ApiException if fails to make API call */ public Map getInventory() throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/inventory"; @@ -134,7 +134,7 @@ public Map getInventory() throws ApiException { * @throws ApiException if fails to make API call */ public Order getOrderById(Long orderId) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'orderId' is set if (orderId == null) { diff --git a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/UserApi.java index 5d44eb9cd82..2298fad6255 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/UserApi.java @@ -178,7 +178,7 @@ public void createUsersWithListInput(List body) throws ApiException { * @throws ApiException if fails to make API call */ public void deleteUser(String username) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -221,7 +221,7 @@ public void deleteUser(String username) throws ApiException { * @throws ApiException if fails to make API call */ public User getUserByName(String username) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -265,7 +265,7 @@ public User getUserByName(String username) throws ApiException { * @throws ApiException if fails to make API call */ public String loginUser(String username, String password) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // verify the required parameter 'username' is set if (username == null) { @@ -312,7 +312,7 @@ public String loginUser(String username, String password) throws ApiException { * @throws ApiException if fails to make API call */ public void logoutUser() throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/logout"; diff --git a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/model/EnumTest.java index 193d7f101db..2bb7dd17d43 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/model/EnumTest.java @@ -67,6 +67,46 @@ public static EnumStringEnum fromValue(String text) { @JsonProperty("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -164,6 +204,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -229,6 +287,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -236,7 +295,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -246,6 +305,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md b/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md +++ b/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md index 737ccc28293..05286676681 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) 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 293591710ea..8467ae0508f 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 @@ -13,6 +13,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -227,6 +228,65 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) thr GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + /** + * + * + * @param body (required) + * @param query (required) + * @throws ApiException if fails to make API call + */ + public void testBodyWithQueryParams(User body, String query) throws ApiException { + + testBodyWithQueryParamsWithHttpInfo(body, query); + } + + /** + * + * + * @param body (required) + * @param query (required) + * @throws ApiException if fails to make API call + */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(User body, String query) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + } + + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } /** * To test \"client\" model * To test \"client\" model 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 1ff3b541245..f7710aa02c0 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 @@ -66,6 +66,46 @@ public static EnumStringEnum fromValue(String text) { @JsonProperty("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -163,6 +203,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -228,6 +286,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return ObjectUtils.equals(this.enumString, enumTest.enumString) && + ObjectUtils.equals(this.enumStringRequired, enumTest.enumStringRequired) && ObjectUtils.equals(this.enumInteger, enumTest.enumInteger) && ObjectUtils.equals(this.enumNumber, enumTest.enumNumber) && ObjectUtils.equals(this.outerEnum, enumTest.outerEnum); @@ -235,7 +294,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return ObjectUtils.hashCodeMulti(enumString, enumInteger, enumNumber, outerEnum); + return ObjectUtils.hashCodeMulti(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -245,6 +304,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/jersey2-java8/docs/EnumTest.md b/samples/client/petstore/java/jersey2-java8/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/EnumTest.md +++ b/samples/client/petstore/java/jersey2-java8/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md index 737ccc28293..05286676681 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeApi.java index 23ed9fc99be..e7a8d43801f 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeApi.java @@ -13,6 +13,7 @@ import java.time.LocalDate; import java.time.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -227,6 +228,65 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) thr GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + /** + * + * + * @param body (required) + * @param query (required) + * @throws ApiException if fails to make API call + */ + public void testBodyWithQueryParams(User body, String query) throws ApiException { + + testBodyWithQueryParamsWithHttpInfo(body, query); + } + + /** + * + * + * @param body (required) + * @param query (required) + * @throws ApiException if fails to make API call + */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(User body, String query) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + } + + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/EnumTest.java index 193d7f101db..2bb7dd17d43 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/EnumTest.java @@ -67,6 +67,46 @@ public static EnumStringEnum fromValue(String text) { @JsonProperty("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -164,6 +204,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -229,6 +287,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -236,7 +295,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -246,6 +305,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/jersey2/docs/EnumTest.md b/samples/client/petstore/java/jersey2/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/jersey2/docs/EnumTest.md +++ b/samples/client/petstore/java/jersey2/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/jersey2/docs/FakeApi.md b/samples/client/petstore/java/jersey2/docs/FakeApi.md index 737ccc28293..05286676681 100644 --- a/samples/client/petstore/java/jersey2/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java index 293591710ea..8467ae0508f 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java @@ -13,6 +13,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -227,6 +228,65 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) thr GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + /** + * + * + * @param body (required) + * @param query (required) + * @throws ApiException if fails to make API call + */ + public void testBodyWithQueryParams(User body, String query) throws ApiException { + + testBodyWithQueryParamsWithHttpInfo(body, query); + } + + /** + * + * + * @param body (required) + * @param query (required) + * @throws ApiException if fails to make API call + */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(User body, String query) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + } + + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java index 193d7f101db..2bb7dd17d43 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java @@ -67,6 +67,46 @@ public static EnumStringEnum fromValue(String text) { @JsonProperty("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -164,6 +204,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -229,6 +287,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -236,7 +295,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -246,6 +305,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md index 737ccc28293..05286676681 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java index beb9cb1f8ff..2876f4ea0ad 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java @@ -32,6 +32,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.lang.reflect.Type; import java.util.ArrayList; @@ -526,6 +527,135 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don apiClient.executeAsync(call, localVarReturnType, callback); return call; } + /** + * Build call for testBodyWithQueryParams + * @param body (required) + * @param query (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call testBodyWithQueryParamsCall(User body, String query, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (query != null) + localVarQueryParams.addAll(apiClient.parameterToPair("query", query)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call testBodyWithQueryParamsValidateBeforeCall(User body, String query, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testBodyWithQueryParams(Async)"); + } + + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException("Missing the required parameter 'query' when calling testBodyWithQueryParams(Async)"); + } + + + com.squareup.okhttp.Call call = testBodyWithQueryParamsCall(body, query, progressListener, progressRequestListener); + return call; + + } + + /** + * + * + * @param body (required) + * @param query (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void testBodyWithQueryParams(User body, String query) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(body, query); + } + + /** + * + * + * @param body (required) + * @param query (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(User body, String query) throws ApiException { + com.squareup.okhttp.Call call = testBodyWithQueryParamsValidateBeforeCall(body, query, null, null); + return apiClient.execute(call); + } + + /** + * (asynchronously) + * + * @param body (required) + * @param query (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call testBodyWithQueryParamsAsync(User body, String query, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = testBodyWithQueryParamsValidateBeforeCall(body, query, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } /** * Build call for testClientModel * @param body client model (required) @@ -670,7 +800,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -877,7 +1007,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testEnumParametersCall(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -1146,7 +1276,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testJsonFormDataCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake/jsonFormData"; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/PetApi.java index 23b9049e61b..163c787d854 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/PetApi.java @@ -184,7 +184,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -308,7 +308,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/findByStatus"; @@ -434,7 +434,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don */ @Deprecated public com.squareup.okhttp.Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/findByTags"; @@ -565,7 +565,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -808,7 +808,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -939,7 +939,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}/uploadImage" diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/StoreApi.java index a517a459d79..0bd2e2c1c62 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/StoreApi.java @@ -63,7 +63,7 @@ public void setApiClient(ApiClient apiClient) { * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/order/{order_id}" @@ -181,7 +181,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/inventory"; @@ -295,7 +295,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/order/{order_id}" diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/UserApi.java index 518d851e31a..99532edeec8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/UserApi.java @@ -417,7 +417,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/{username}" @@ -536,7 +536,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/{username}" @@ -660,7 +660,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/login"; @@ -793,7 +793,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/logout"; diff --git a/samples/client/petstore/java/okhttp-gson/docs/EnumTest.md b/samples/client/petstore/java/okhttp-gson/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/EnumTest.md +++ b/samples/client/petstore/java/okhttp-gson/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md index 737ccc28293..05286676681 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java index beb9cb1f8ff..2876f4ea0ad 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -32,6 +32,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.lang.reflect.Type; import java.util.ArrayList; @@ -526,6 +527,135 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don apiClient.executeAsync(call, localVarReturnType, callback); return call; } + /** + * Build call for testBodyWithQueryParams + * @param body (required) + * @param query (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call testBodyWithQueryParamsCall(User body, String query, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (query != null) + localVarQueryParams.addAll(apiClient.parameterToPair("query", query)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call testBodyWithQueryParamsValidateBeforeCall(User body, String query, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testBodyWithQueryParams(Async)"); + } + + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException("Missing the required parameter 'query' when calling testBodyWithQueryParams(Async)"); + } + + + com.squareup.okhttp.Call call = testBodyWithQueryParamsCall(body, query, progressListener, progressRequestListener); + return call; + + } + + /** + * + * + * @param body (required) + * @param query (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void testBodyWithQueryParams(User body, String query) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(body, query); + } + + /** + * + * + * @param body (required) + * @param query (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(User body, String query) throws ApiException { + com.squareup.okhttp.Call call = testBodyWithQueryParamsValidateBeforeCall(body, query, null, null); + return apiClient.execute(call); + } + + /** + * (asynchronously) + * + * @param body (required) + * @param query (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call testBodyWithQueryParamsAsync(User body, String query, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = testBodyWithQueryParamsValidateBeforeCall(body, query, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } /** * Build call for testClientModel * @param body client model (required) @@ -670,7 +800,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -877,7 +1007,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testEnumParametersCall(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake"; @@ -1146,7 +1276,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call testJsonFormDataCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/fake/jsonFormData"; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java index 23b9049e61b..163c787d854 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java @@ -184,7 +184,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -308,7 +308,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/findByStatus"; @@ -434,7 +434,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don */ @Deprecated public com.squareup.okhttp.Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/findByTags"; @@ -565,7 +565,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -808,7 +808,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}" @@ -939,7 +939,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/pet/{petId}/uploadImage" diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java index a517a459d79..0bd2e2c1c62 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java @@ -63,7 +63,7 @@ public void setApiClient(ApiClient apiClient) { * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/order/{order_id}" @@ -181,7 +181,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/inventory"; @@ -295,7 +295,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/store/order/{order_id}" diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java index 518d851e31a..99532edeec8 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java @@ -417,7 +417,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/{username}" @@ -536,7 +536,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/{username}" @@ -660,7 +660,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/login"; @@ -793,7 +793,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; + Object localVarPostBody = new Object(); // create path and map variables String localVarPath = "/user/logout"; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java index a572c0d6b5b..7a1b9c32152 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java @@ -82,6 +82,58 @@ public EnumStringEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + @JsonAdapter(EnumStringRequiredEnum.Adapter.class) + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringRequiredEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringRequiredEnum.fromValue(String.valueOf(value)); + } + } + } + + @SerializedName("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -203,6 +255,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -268,6 +338,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -275,7 +346,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -285,6 +356,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/AnotherFakeApi.java b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/AnotherFakeApi.java index d72ac5874d0..272882e3b2d 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/AnotherFakeApi.java @@ -14,17 +14,25 @@ package io.swagger.client.api; import com.google.gson.reflect.TypeToken; +import io.swagger.client.model.Client; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import io.restassured.RestAssured; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; import io.restassured.response.Response; -import io.swagger.client.model.Client; import java.lang.reflect.Type; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Supplier; +import io.swagger.client.JSON; -import static io.restassured.http.Method.PATCH; +import static io.restassured.http.Method.*; public class AnotherFakeApi { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java index 27668ea05e3..1e0db93a2e6 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -14,17 +14,25 @@ package io.swagger.client.api; import com.google.gson.reflect.TypeToken; +import io.swagger.client.model.Client; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import io.restassured.RestAssured; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; import io.restassured.response.Response; -import io.swagger.client.model.Client; import java.lang.reflect.Type; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Supplier; +import io.swagger.client.JSON; -import static io.restassured.http.Method.PATCH; +import static io.restassured.http.Method.*; public class FakeClassnameTags123Api { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/PetApi.java index 83f0d59b21e..b3758e6dc14 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/PetApi.java @@ -14,23 +14,27 @@ package io.swagger.client.api; import com.google.gson.reflect.TypeToken; +import java.io.File; +import io.swagger.client.model.ModelApiResponse; +import io.swagger.client.model.Pet; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import io.restassured.RestAssured; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; import io.restassured.response.Response; -import io.swagger.client.model.ModelApiResponse; -import io.swagger.client.model.Pet; -import java.io.File; import java.lang.reflect.Type; -import java.util.List; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Supplier; +import io.swagger.client.JSON; -import static io.restassured.http.Method.DELETE; -import static io.restassured.http.Method.GET; -import static io.restassured.http.Method.POST; -import static io.restassured.http.Method.PUT; +import static io.restassured.http.Method.*; public class PetApi { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/StoreApi.java index b0925e849ca..8e810ef8333 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/StoreApi.java @@ -14,20 +14,25 @@ package io.swagger.client.api; import com.google.gson.reflect.TypeToken; +import io.swagger.client.model.Order; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import io.restassured.RestAssured; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; import io.restassured.response.Response; -import io.swagger.client.model.Order; import java.lang.reflect.Type; -import java.util.Map; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Supplier; +import io.swagger.client.JSON; -import static io.restassured.http.Method.DELETE; -import static io.restassured.http.Method.GET; -import static io.restassured.http.Method.POST; +import static io.restassured.http.Method.*; public class StoreApi { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/UserApi.java index fee116cd433..47bda73c87d 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/UserApi.java @@ -14,21 +14,25 @@ package io.swagger.client.api; import com.google.gson.reflect.TypeToken; +import io.swagger.client.model.User; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import io.restassured.RestAssured; import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; import io.restassured.response.Response; -import io.swagger.client.model.User; import java.lang.reflect.Type; -import java.util.List; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Supplier; +import io.swagger.client.JSON; -import static io.restassured.http.Method.DELETE; -import static io.restassured.http.Method.GET; -import static io.restassured.http.Method.POST; -import static io.restassured.http.Method.PUT; +import static io.restassured.http.Method.*; public class UserApi { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/model/EnumTest.java index 6a7c8d2d992..7a1b9c32152 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/model/EnumTest.java @@ -13,15 +13,17 @@ package io.swagger.client.model; +import java.util.Objects; +import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - +import io.swagger.client.model.OuterEnum; import java.io.IOException; -import java.util.Objects; /** * EnumTest diff --git a/samples/client/petstore/java/resteasy/docs/EnumTest.md b/samples/client/petstore/java/resteasy/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/resteasy/docs/EnumTest.md +++ b/samples/client/petstore/java/resteasy/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/resteasy/docs/FakeApi.md b/samples/client/petstore/java/resteasy/docs/FakeApi.md index 737ccc28293..05286676681 100644 --- a/samples/client/petstore/java/resteasy/docs/FakeApi.md +++ b/samples/client/petstore/java/resteasy/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/FakeApi.java index 9a9757e898b..c693fc37007 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/api/FakeApi.java @@ -12,6 +12,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -182,6 +183,53 @@ public String fakeOuterStringSerialize(String body) throws ApiException { GenericType localVarReturnType = new GenericType() {}; return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + /** + * + * + * @param body (required) + * @param query (required) + * @throws ApiException if fails to make API call + */ + public void testBodyWithQueryParams(User body, String query) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + } + + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-query-params".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + + apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + } /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/model/EnumTest.java index 193d7f101db..2bb7dd17d43 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/resteasy/src/main/java/io/swagger/client/model/EnumTest.java @@ -67,6 +67,46 @@ public static EnumStringEnum fromValue(String text) { @JsonProperty("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -164,6 +204,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -229,6 +287,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -236,7 +295,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -246,6 +305,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/EnumTest.md b/samples/client/petstore/java/resttemplate-withXml/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/EnumTest.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md index 737ccc28293..05286676681 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/api/FakeApi.java index 9bb930c3003..5708ef2509e 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/api/FakeApi.java @@ -7,6 +7,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -157,6 +158,47 @@ public String fakeOuterStringSerialize(String body) throws RestClientException { ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } + /** + * + * + *

200 - Success + * @param body The body parameter + * @param query The query parameter + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void testBodyWithQueryParams(User body, String query) throws RestClientException { + Object postBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + } + + // verify the required parameter 'query' is set + if (query == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + + String path = UriComponentsBuilder.fromPath("/fake/body-with-query-params").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "query", query)); + + final String[] accepts = { }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { + "application/json" + }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/EnumTest.java index 3827113df36..08d817e1952 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/io/swagger/client/model/EnumTest.java @@ -74,6 +74,48 @@ public static EnumStringEnum fromValue(String text) { @XmlElement(name = "enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string_required") + @JacksonXmlProperty(localName = "enum_string_required") + @XmlElement(name = "enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -177,6 +219,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -242,6 +302,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -249,7 +310,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -259,6 +320,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/resttemplate/docs/EnumTest.md b/samples/client/petstore/java/resttemplate/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/resttemplate/docs/EnumTest.md +++ b/samples/client/petstore/java/resttemplate/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/resttemplate/docs/FakeApi.md b/samples/client/petstore/java/resttemplate/docs/FakeApi.md index 737ccc28293..05286676681 100644 --- a/samples/client/petstore/java/resttemplate/docs/FakeApi.md +++ b/samples/client/petstore/java/resttemplate/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeApi.java index 9bb930c3003..5708ef2509e 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeApi.java @@ -7,6 +7,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -157,6 +158,47 @@ public String fakeOuterStringSerialize(String body) throws RestClientException { ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } + /** + * + * + *

200 - Success + * @param body The body parameter + * @param query The query parameter + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void testBodyWithQueryParams(User body, String query) throws RestClientException { + Object postBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + } + + // verify the required parameter 'query' is set + if (query == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + + String path = UriComponentsBuilder.fromPath("/fake/body-with-query-params").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "query", query)); + + final String[] accepts = { }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { + "application/json" + }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/EnumTest.java index 193d7f101db..2bb7dd17d43 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/EnumTest.java @@ -67,6 +67,46 @@ public static EnumStringEnum fromValue(String text) { @JsonProperty("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -164,6 +204,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -229,6 +287,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -236,7 +295,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -246,6 +305,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java index 07681e62c98..cb1a8d27d40 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java @@ -11,6 +11,7 @@ import org.joda.time.DateTime; import org.joda.time.LocalDate; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -114,6 +115,32 @@ String fakeOuterStringSerialize( void fakeOuterStringSerialize( @retrofit.http.Body String body, Callback cb ); + /** + * + * Sync method + * + * @param body (required) + * @param query (required) + * @return Void + */ + + @PUT("/fake/body-with-query-params") + Void testBodyWithQueryParams( + @retrofit.http.Body User body, @retrofit.http.Query("query") String query + ); + + /** + * + * Async method + * @param body (required) + * @param query (required) + * @param cb callback method + */ + + @PUT("/fake/body-with-query-params") + void testBodyWithQueryParams( + @retrofit.http.Body User body, @retrofit.http.Query("query") String query, Callback cb + ); /** * To test \"client\" model * Sync method diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumTest.java index a572c0d6b5b..7a1b9c32152 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/EnumTest.java @@ -82,6 +82,58 @@ public EnumStringEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + @JsonAdapter(EnumStringRequiredEnum.Adapter.class) + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringRequiredEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringRequiredEnum.fromValue(String.valueOf(value)); + } + } + } + + @SerializedName("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -203,6 +255,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -268,6 +338,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -275,7 +346,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -285,6 +356,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/retrofit2-play24/docs/EnumTest.md b/samples/client/petstore/java/retrofit2-play24/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/EnumTest.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md b/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md index 9526fadf552..e4a81dc097b 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java index 64649d8607a..e7e9326e323 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java @@ -14,6 +14,7 @@ import java.time.LocalDate; import java.time.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -68,6 +69,21 @@ F.Promise> fakeOuterStringSerialize( @retrofit2.http.Body String body ); + /** + * + * + * @param body (required) + * @param query (required) + * @return Call<Void> + */ + @Headers({ + "Content-Type:application/json" + }) + @PUT("fake/body-with-query-params") + F.Promise> testBodyWithQueryParams( + @retrofit2.http.Body User body, @retrofit2.http.Query("query") String query + ); + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumTest.java index 59a060b266c..d0cfaa66374 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumTest.java @@ -69,6 +69,46 @@ public static EnumStringEnum fromValue(String text) { @JsonProperty("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -166,6 +206,25 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -232,6 +291,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -239,7 +299,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -249,6 +309,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/retrofit2/docs/EnumTest.md b/samples/client/petstore/java/retrofit2/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/retrofit2/docs/EnumTest.md +++ b/samples/client/petstore/java/retrofit2/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/retrofit2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2/docs/FakeApi.md index 9526fadf552..e4a81dc097b 100644 --- a/samples/client/petstore/java/retrofit2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java index 06810d19a1f..3791b24a272 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java @@ -14,6 +14,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -65,6 +66,21 @@ Call fakeOuterStringSerialize( @retrofit2.http.Body String body ); + /** + * + * + * @param body (required) + * @param query (required) + * @return Call<Void> + */ + @Headers({ + "Content-Type:application/json" + }) + @PUT("fake/body-with-query-params") + Call testBodyWithQueryParams( + @retrofit2.http.Body User body, @retrofit2.http.Query("query") String query + ); + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumTest.java index a572c0d6b5b..7a1b9c32152 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/EnumTest.java @@ -82,6 +82,58 @@ public EnumStringEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + @JsonAdapter(EnumStringRequiredEnum.Adapter.class) + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringRequiredEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringRequiredEnum.fromValue(String.valueOf(value)); + } + } + } + + @SerializedName("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -203,6 +255,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -268,6 +338,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -275,7 +346,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -285,6 +356,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/retrofit2rx/docs/EnumTest.md b/samples/client/petstore/java/retrofit2rx/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/EnumTest.md +++ b/samples/client/petstore/java/retrofit2rx/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md index 9526fadf552..e4a81dc097b 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java index 0defac625ef..30b3dd4e1b6 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java @@ -14,6 +14,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -65,6 +66,21 @@ Observable fakeOuterStringSerialize( @retrofit2.http.Body String body ); + /** + * + * + * @param body (required) + * @param query (required) + * @return Observable<Void> + */ + @Headers({ + "Content-Type:application/json" + }) + @PUT("fake/body-with-query-params") + Observable testBodyWithQueryParams( + @retrofit2.http.Body User body, @retrofit2.http.Query("query") String query + ); + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumTest.java index a572c0d6b5b..7a1b9c32152 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/EnumTest.java @@ -82,6 +82,58 @@ public EnumStringEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + @JsonAdapter(EnumStringRequiredEnum.Adapter.class) + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringRequiredEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringRequiredEnum.fromValue(String.valueOf(value)); + } + } + } + + @SerializedName("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -203,6 +255,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -268,6 +338,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -275,7 +346,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -285,6 +356,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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"); diff --git a/samples/client/petstore/java/retrofit2rx2/docs/EnumTest.md b/samples/client/petstore/java/retrofit2rx2/docs/EnumTest.md index 08fee344882..ca048bcc515 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/EnumTest.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md index 9526fadf552..e4a81dc097b 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** fake/outer/string | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** fake | To test enum parameters @@ -195,6 +196,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(body, query) + + + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +User body = new User(); // User | +String query = "query_example"; // String | +try { + apiInstance.testBodyWithQueryParams(body, query); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| | + **query** | **String**| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/api/FakeApi.java index 7c1fd4ae0d5..0fe704b5b0e 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/api/FakeApi.java @@ -15,6 +15,7 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; +import io.swagger.client.model.User; import java.util.ArrayList; import java.util.HashMap; @@ -66,6 +67,21 @@ Observable fakeOuterStringSerialize( @retrofit2.http.Body String body ); + /** + * + * + * @param body (required) + * @param query (required) + * @return Completable + */ + @Headers({ + "Content-Type:application/json" + }) + @PUT("fake/body-with-query-params") + Completable testBodyWithQueryParams( + @retrofit2.http.Body User body, @retrofit2.http.Query("query") String query + ); + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/model/EnumTest.java index a572c0d6b5b..7a1b9c32152 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/model/EnumTest.java @@ -82,6 +82,58 @@ public EnumStringEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + @JsonAdapter(EnumStringRequiredEnum.Adapter.class) + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringRequiredEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringRequiredEnum.fromValue(String.valueOf(value)); + } + } + } + + @SerializedName("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -203,6 +255,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -268,6 +338,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -275,7 +346,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -285,6 +356,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).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");