diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 53dddf3269cd..df599c8aed3e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -1450,10 +1450,6 @@ public class ApiClient { * @throws {{invokerPackage}}.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1481,10 +1477,12 @@ public class ApiClient { reqBody = serialize(body, contentType); } + List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/ApiClient.java index a524171d7e1a..04873e441bfb 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/ApiClient.java @@ -1267,10 +1267,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1298,10 +1294,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java index 4df37d3b3d50..0a0e4931dd65 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -1197,10 +1197,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1228,10 +1224,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/ApiClient.java index 6dc504682e48..7a30022d525a 100644 --- a/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/ApiClient.java @@ -1171,10 +1171,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1202,10 +1198,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java index 8382b35e5de4..a4e0825ef4fd 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java @@ -1194,10 +1194,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1225,10 +1221,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/ApiClient.java index a524171d7e1a..04873e441bfb 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/ApiClient.java @@ -1267,10 +1267,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1298,10 +1294,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java index 4708b9034701..609ef1932667 100644 --- a/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java @@ -1287,10 +1287,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1318,10 +1314,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java index e4443654b300..f28161712e09 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java @@ -1272,10 +1272,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1303,10 +1299,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java index a524171d7e1a..04873e441bfb 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java @@ -1267,10 +1267,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1298,10 +1294,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/ApiClient.java index 690c499f5936..775213da3dec 100644 --- a/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-nullable-required/src/main/java/org/openapitools/client/ApiClient.java @@ -1270,10 +1270,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1301,10 +1297,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java index d16ca42dee12..40f343c58676 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java @@ -1273,10 +1273,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1304,10 +1300,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java index a524171d7e1a..04873e441bfb 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java @@ -1267,10 +1267,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1298,10 +1294,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/ApiClient.java index a524171d7e1a..04873e441bfb 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-swagger2/src/main/java/org/openapitools/client/ApiClient.java @@ -1267,10 +1267,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1298,10 +1294,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java index d3c3e6d35035..25b61595d492 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -1341,10 +1341,6 @@ public Call buildCall(String baseUrl, String path, String method, List que * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams - List allQueryParams = new ArrayList(queryParams); - allQueryParams.addAll(collectionQueryParams); - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); // prepare HTTP request body @@ -1372,10 +1368,12 @@ public Request buildRequest(String baseUrl, String path, String method, List updatedQueryParams = new ArrayList<>(queryParams); + // update parameters with authentication settings - updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); - final Request.Builder reqBuilder = new Request.Builder().url(url); + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); processCookieParams(cookieParams, reqBuilder);