Open Malte-Neu opened 2 years ago
This also makes it impossible to just send a JSON-formatted String as-is to the server. The JSON-String now always gets double-encoded. Unfortunately there doesn't seem to be workaround other than to extend the ApiClient and overriding the serialize
method with a saner implementation.
@wing328 This problem is really a blocker for us (if you don't consider workaround with ApiClient extend). Is there a possiblity to priorize this issue and solve it?
@deki-ch would you like to file a PR to fix the issue or sponsor the fix?
Description
When transferring data in the requestBody with content-Type != 'Application / x-www-form-urlencoded' and 'multipart / form-data', each string is placed in quotation marks and all quotation marks inside the string are escaped with \".
The problem arises in the function ApiClient.serialize where the string is put in quotation marks for almost all content types. This means that no plain text, XML, etc. transmission is possible.
openapi-generator version
5.2, master
OpenAPI declaration file content or url
Command line used for generation
generate -i api.yaml -g java --library jersey2 -o
Related issues/PRs
6956
6954
Suggest a fix/enhancement
Modification of the file https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache so that this code is created:
So the changes made in #6956 only applies to json and not to other contenttypes like plaintext, xml etc.