DATAREST-739 Using different projection for each entity subtype
What took the most time and effort weren't sub-projections, but actually trying to properly support serialization with type information, considering the usage of resource wrappers and projections. I've created multiple tests for the modified parts (there have been almost no tests before), but it's possible to do more tests still, since the underlying Jackson serializer behavior can be quite complicated.
Now each projection can have @JsonTypeInfo specified (see tests), which will override the same annotation on the projected target class. However, this only works as long as @JsonTypeInfo doesn't specify use = JsonTypeInfo.Id.NONE. This is because this case is indistinguishable (based on Jackson behavior) from not specifying @JsonTypeInfo at all, so it's not possible to use this to "disable" type info for projections. I can imagine this could be a problem for someone who wants to use a projection to disable type information on projected classes...
I'm a new contributor. ICLA confirmation code 168920160323094307.
Please can you merge?
Thanks @dodecaedro for rebase.
Thanks to you for your work on it.
Now could someone please merge the pull request? Thank you.
According to the author this PR "required a lot of changes to existing structure of Jackson2 serialization module, as well as introduction of a new field to support the projection hierarchy, so it's not clear when this will be merged." Source: stackoverflow