-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Change JsonNode.with(String)
and withArray(String)
to consider argument as JsonPointer
if valid expression
#3568
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
Comments
JsonNode.with(String)
and withArray(String)
to consider argument as JsonPointer
(if valid)JsonNode.with(String)
and withArray(String)
to consider argument as JsonPointer
if valid expression
For the corner case where a user is creating/fetching keys that start with a forward slash this change is unequivocally not backwards compatible. Given that (I'm not personally effected by this change, was just wondering what the closest replacement for the deprecated |
We hit this exact issue when upgrading Jackson. The main issue is around looking up or performing iterative logic on keys dynamically rather than hardcoding the pointer or parameter argument. This leads to an unexpected difference in behavior when the key just happens to start with a slash. (I.e. when traversing JSON data that involves HTTP path segments, for example OpenAPI specs). In our case, without a workaround exposed on the JsonNode class, we had to manually escape any dynamic property passed into
@cowtowncoder Could we ensure this one is added to the "Changes, compatibility" section of the 2.14 release notes indicating the breaking change please? |
@alasdairhurst Happy to add a note -- could use help in formulating what is said. |
Added link, brief description. For anyone looking into solution, Jackson 2.16 added |
Thank you for suggestion, @alasdairhurst ! |
Thanks @cowtowncoder. Something along the lines of the following. I'll leave it up to you to tweak/correct and place as you see fit. Changes, behaviorBreaking changes
|
@alasdairhurst Thank you -- I adjusted https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.14 as suggested. |
With #1980 there are new methods/overloads for
withArray()
andwith()
, which takeJsonPointer
.The old methods that take
String
should be retrofitted in 2.x so that:JsonPointer
(that is, starts with leading '/` or is empty String ""), it should be used as suchJsonPointer
, should it check existingproperty
.For Jackson 3.0 we can just drop the check and expect valid
JsonPointer
String representation.The reason for change is to make expected main use case work, while retaining reasonable backwards-compatibility.
The text was updated successfully, but these errors were encountered: