-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Do not automatically trim trailing whitespace from java.util.regex.Pattern
values
#3299
Comments
(EDITED) I can't promise I'll have time to work on this, but one thing that would help whoever had time to tackle this feature request would be to file a failing unit test showing expected behavior that is not occurring. Oh: I suspect there might already be a way to reconfigure new-ish "Coercion Config" setting -- by default it is rather permissive, but it may be possible to change that easily. |
FromStringDeserializer
not to trim JSON string value when deserializing JDK types like java.util.regex.Pattern
Hmmmh. Looking at reference This is both easier and more difficult thing since it is sort of irregular... @jberger how about an alternative of specifically disabling trimming for |
I think that an improvement to handling Patterns, specifically, would fit in 2.13(.1) patch, changing target. |
FromStringDeserializer
not to trim JSON string value when deserializing JDK types like java.util.regex.Pattern
java.util.regex.Pattern
values
Is your feature request related to a problem? Please describe.
I have a large JSON structure containing arrays of Patterns to match as part of a lookup. Some contain patterns that end in an escaped literal space, ie
\\
. When this happens the trim behavior (that I had to search rather hard to find) causes the pattern to now end in an escape character which then fails to compile as a Pattern.Describe the solution you'd like
While I can understand trimming string values in XML as an unfortunate side-effect of the whitespace independent structure, in JSON I would have expected to be somewhat more literal. Even so if this is the behavior that more people want, can you please at least add an attribute that would prevent trimming?
Usage example
Something like
.with(DeserializationFeature.NO_TRIM)
would be sufficient.Additional context
I'm sure I must have missed something in the documentation but I was not easy to find that values were supposed to be trimmed. Indeed my searching mostly found people asking in various forums how to cause the values to be trimmed, not to prevent them from being trimmed. Clarifying that behavior in the documentation would be nice as well.
Thanks
The text was updated successfully, but these errors were encountered: