-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Configuration option to disable HTML escaping when using Gson #298
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,8 @@ public Class getClassForElement(JsonElement readElement) { | |
} | ||
}) | ||
; | ||
return fireBuilder.createGsonBuilder(); | ||
GsonBuilder builder = fireBuilder.createGsonBuilder(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all good |
||
return builder; | ||
} | ||
|
||
private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,8 @@ public Class getClassForElement(JsonElement readElement) { | |
} | ||
}) | ||
; | ||
return fireBuilder.createGsonBuilder(); | ||
GsonBuilder builder = fireBuilder.createGsonBuilder(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all good |
||
return builder; | ||
} | ||
|
||
private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { | ||
|
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.
did you forget to put the
{{#disableHtmlEscaping}}
?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.
No, I did not forget, I chose to always declare the variable and conditionally set
disableHtmlEscaping
:This keeps the complexity of the mustache code low, and makes it easy to accommodate more options in the future. For example:
I can modify the template to handle the "no options" situation to avoid declaring the variable in generated Java-classes, if that is preferable?
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.
It's my bad, since the path to the file was truncated by github UI, I did not realize it was a generated sample. Makes total sense! Keep it that way :)