-
-
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
Add descriptive exception for attempts to use @JsonWrapped
via Creator parameter
#265
Comments
Thought I'd paste the relevant exception here, to help in finding this issue:
|
+1 |
+1 ... I think it should be possible to remove any suffix/prefix that was added when unwrapping and call a JsonCreator with the remaining / cleaned field names. No? |
@weaselmetal You are welcome to check how easy that would be to do. Unfortunately I won't have time to work on this issue any time soon. |
Ok. After first falsely concluding that this could work, I am realizing that the way unwrapped properties are implemented, they will NOT be supportable as constructor-backed creator properties without major rewrite. So. What I will do for 2.9 is to add checks so that attempts to do this should fail earlier with more descriptive error message. I will also remove code that tries to handle the case since it can not work as designed: Creator expects fully resolved unwrapped values, but unwrapped-value resolved can only run after Creator has created the POJO to assign values to. But I will create a new issue for potentially doing said major rewrite to add support, since it is theoretically doable. Just not with small/medium incremental changes. |
@JsonUnwrapped
with @JsonCreator
(if possible)@JsonWrapped
via Creator parameter
For 2.19, support is actually being added -- after all these years! See #1467 for details. |
@JsonUnwrapped
does not currently work with creator parameters; both because name linkage is needed (despite not being used), but also because unwrapped-handler absolutely requires existence of POJO to assign reconstructed value to -- which can not be done without Creator having access. So basic chicken-and-egg problem.While this is theoretically (and hopefully ultimately) solvable problem, at this point (jackson 2.9 development) it is better to add clear exception to indicate the issue, instead of producing a confusing and misleading exception like currently happens.
The text was updated successfully, but these errors were encountered: