-
-
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
Polymorphic class with @JsonUnwrapped
throwing "Unrecognized field" after upgrade to 2.18
#4792
Comments
Thank you for reporting @martin-frydl 🙏🏼 There is a chance this is regression caused by #4515. As always, will submit failing test against 2.18. PS I tried digging into it by comparing 2.17 vs 2.18 version. It seems Creator detection flow changed like this: In 2.17 class |
@JsonUnwrapped
throwing "Unrecognized field" after upgrade to 2.18
UPDATE : Did some hard digging into the difference made. So..
This is taking longer than expected, but getting the hang of it. |
I wonder if the issue are the annotation combination used:
I am suspicious of |
@JooHyukKim Single-arg constructor definitely should be considered properties-based (due to |
Btw, changing static class SubA implements Parent {
private Model model;
@JsonCreator
public SubA(@JsonUnwrapped Model model) {
this.model = model;
}
} I think you are right about ...
... placement and We can also advise users to follow new usage if the usage is off or intended as long as we provide more documentation, then it would be fine. |
Ohhhhhhh. Now I get it -- because And then So maybe what is attempted would work better with:
if I finally understood intent correctly. |
So yeah @martin-frydl. What do u think? |
FYI @cowtowncoder , what I said above about working is in version 2.18. Below declaration succeeds deserialization static class SubA implements Parent {
private Model model;
@JsonCreator
public SubA(@JsonUnwrapped Model model) {
this.model = model;
}
} |
Anyway @martin-frydl if you need "exactly same" declaration with static class SubA implements Parent {
@JsonUnwrapped
@JsonProperty(access = READ_ONLY)
private Model model;
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public SubA(@JsonProperty("model") Model model) {
this.model = model;
}
} |
Search before asking
Describe the bug
I have following code:
When run in 2.17.3, it works fine. However, in 2.18 it started to fail:
Version Information
2.18.0, 2.18.1
Reproduction
<-- Any of the following
-->
// Your code here
Expected behavior
No response
Additional context
Could be related to issue #1497 but is a bit different and worked before.
The text was updated successfully, but these errors were encountered: