Deserialize failed when using referencing and the object does not have an empty constructor #4433
Open
1 task done
Labels
to-evaluate
Issue that has been received but not yet evaluated
Search before asking
Describe the bug
I found a strange issue when trying to deserialize a specific object with the next conditions:
JsonTypeInfo
and implement some interface)JsonIdentityInfo
In that case I have an exception:
If I add an empty contractor to this object it works fine. But in my case I can not change this object (its coming from library)
Version Information
2.16.2
Reproduction
here a detail example: test-generic-ser
Generic interface with
JsonIdentityInfo
andJsonTypeInfo
: Animal.javaDog implementation without empty constructor: Dog.java
Cat implementation with empty constructor: Cat.java
Dog tests:
json
test works: canDeserializeWhenNoChildren
json
test failed: canNotDeserializeWhenHasChildren
Cat test (object with empty constructor):
json
test works: canDeserializeWhenHasChildrenAndEmptyConstructor
ObjectMapper configuration (I used the same objectMapper to generate json): ObjectMapper
In additional I use
jackson-module-parameter-names
: maven param names dependencyExpected behavior
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: