immutables
immutables copied to clipboard
Immutables does not work correctly with Jackson's JsonTypeInfo.Id.DEDUCTION
Jackson introduced a new subtype resolver recently called JsonTypeInfo.Id.DEDUCTION. This observes the property names of the json and resolves it based on the shape of the incoming data. Unfortunately, the unusual pattern used to construct the immutables objects is incompatible with using this new type of deduction. In the project I was working on we had to move to using java's weaker Record capabilities since it worked correctly with the deduction scheme.
More info on this new resolver can be found here: https://fasterxml.github.io/jackson-annotations/javadoc/2.12/com/fasterxml/jackson/annotation/JsonTypeInfo.Id.html#DEDUCTION
While I understand the feature (we did something similar for Gson https://immutables.github.io/json.html#polymorphic-mapping ) It's unclear what have to be done to make it work. If there would be a PR or at least clear recipe showing how we can fix the situation we would proceed on this.