-
Notifications
You must be signed in to change notification settings - Fork 118
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
Inconsistent BeanPropertyDefinition#couldDeserialize and actual deserialization behavior #316
Comments
Ok, couple of comments. First of all thank you for pointing out misleading comment. I fixed it in 2.17 branch. Second: the main public API for wrt whether something is deserializable is Instead, I would simply base likely deserializability on existence of Finally: as to the original method in question: it is likely it will again return |
Ok: I consider Closing. |
Thanks for the explanation! That was really helpful. |
@kaqqao Thank you for your understanding; glad you got it working. |
Search before asking
Describe the bug
A bean property with an inaccessible (private) field and an implicit constructor returns
true
fromBeanPropertyDefinition#couldDeserialize
in 2.16.1, andfalse
in 2.17.1. Yet both versions deserialize the bean and the field just fine. So the meta model and the deserializer behavior are inconsistent.Specifically, this line was added to jackson-databind in 2.17 (despite the comment claiming "since 2.16") to address #736. And that bug was masking this one, as Jackson believed the field to be deserializable purely because the Java field existed, despite being inaccessible.
So maybe this is actually intentional behavior? But the meta-model/deserializer inconsistency is still surprising.
Version Information
2.17.1
Reproduction
Expected behavior
I'd expect bean deserialization to fail if
BeanPropertyDefinition#couldDeserialize == false
for one of the implicated fields.Or, alternatively,
BeanPropertyDefinition#couldDeserialize
to returntrue
if a usable bound constructor parameter is found.Additional context
I am using Jackson's meta model to introspect Java types and create equivalent GraphQL types. For types used as inputs, it is important to know what fields are deserializable, as non-deserializable fields should not be mapped to GraphQL. For this reason, I have an extensive suite of tests for all sorts of Java types and deserialization configurations, and one of the tests caught this change in Jackson 2.17.
I originally opened an issue on jackson-databind but have since realized the problem is technically in this module. So I closed the original and opened this instead.
The text was updated successfully, but these errors were encountered: