-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Java] Configuration option to disable HTML escaping when using Gson #7966
[Java] Configuration option to disable HTML escaping when using Gson #7966
Conversation
The default implementation of Gson will escape certain characters by default. This includes the `=` character, which is used in base64 encoding and cause problems when deserializing the value to a base64 encoded string in a service. Adding an option for disabling this feature makes it easier to generate client code with sane defaults.
I'd like to see more documentation describing the need and what is done. It takes some looking around to figure it out. |
This is a small change, but generating the Petstore example created a large diff. To see what this PR contains, it's easiest to view the relevant commit directly. What do this PR include A new option Why is this needed When base64 support was implemented, the author initially disabled the Gson default for strings, which is to escape characters that could cause problems in an XML document. He did this because the escape feature caused problems with the According to RFC 4648, base64 use a limited character subset, in addition to the
This means that I encountered this problem when I integrated with a service that accepts base64, processed through Spring and Jackson. When we send base64 data to the service, it works just fine. However, when the |
@jeff9finger Do you need anything more to review the pull request? |
Great explanation and documentation! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@HugoMario Any possibility for merging this? |
yes, sorry for delay, thanks!! |
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.3.0.0
branch for changes related to OpenAPI spec 3.0. Default:master
.Description of the PR
The default implementation of Gson will escape certain characters. This includes the
=
character, which is used in base64 encoding and cause problems when deserializing the value to a base64 encoded string in a service.Adding an option for disabling this feature makes it easier to generate client code with sane defaults.