Closed josevsgeon closed 3 weeks ago
Ok we are almost there, but just to make sure reproduction is fully valid, it'd be great to include actual code and input used -- to rule out possibility of misunderstand with description.
i tried to create a minimal reproduction test case, but reproduction is a bit inconsistent. sometimes, it works, other times, it fails. I'm now not sure if the problem is with List.
Then let's close the issue for now, re-open later when you get the 100% reproduction?
Search before asking
Describe the bug
When using Jackson’s
@JsonTypeInfo
withId.DEDUCTION
for polymorphic deserialization, the deduction mechanism fails to correctly identify subtypes within aList
field. Specifically, if a class contains aList
of an interface type (e.g.,List<BaseType>
), and multiple subtypes of the interface are expected within the list, Jackson fails to deduce the individual type of each element, resulting in anInvalidTypeIdException
. This occurs even if the subtypes have unique fields that should allow for distinct deduction.Version Information
2.17.2
Reproduction
BaseType
) with several distinct implementations (SubTypeA
,SubTypeB
), each having unique fields.CompositeType
) containing aList<BaseType>
field annotated with@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
.BaseType
implementations in the list, where each object has unique fields relevant to its type.Expected behavior
Each element within the
List
should be deduced individually, allowing Jackson to correctly identify and deserialize each element to the appropriate subtype based on its unique fields.Additional context
No response