[BUG][Java][resttemplate] Query param values not encoded anymore
Created by: Willem1987
Description
We are currently on OpenApi generator 5.4.0. Due to issues generating polymorphic classes we tried to upgrade to 6.0.1.
We are using a queryparam with a callback url of a string type currently.
In version 5.4.0 the ApiClient had this line:
if (value != null) { String templatizedKey = encodedName + valueItemCounter++; final String encodedValue = URLEncoder.encode(value.toString(), "UTF-8"); uriParams.put(templatizedKey, encodedValue); queryBuilder.append('=').append("{").append(templatizedKey).append("}"); }
In 6.0.1 the code changed to:
if (value != null) { String templatizedKey = encodedName + valueItemCounter++; uriParams.put(templatizedKey, value.toString()); queryBuilder.append('=').append("{").append(templatizedKey).append("}"); }
Without the encoding somehow our url changed from: /some-mock/api/1.0/endpoint/method?callbackUrl=http:/**/**other-service/servicename/api/1.0/endpoint/method to /some-mock/api/1.0/endpoint/method?callbackUrl=http:/other-service/servicename/api/1.0/endpoint/method
This is a problem because i don't think http:/ would be a valid url. Also it breaks our wiremock expects in integration tests.
openapi-generator version
6.0.1.
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/11921 https://github.com/OpenAPITools/openapi-generator/pull/11922
It seems mentioned PR and issue changed the behavior, but i am unsure as to how i should restore our application with this.