spring-data-rest icon indicating copy to clipboard operation
spring-data-rest copied to clipboard

DATAREST-739 Using different projection for each entity subtype

Open koscejev opened this issue 9 years ago • 6 comments

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...

koscejev avatar Mar 23 '16 22:03 koscejev

I'm a new contributor. ICLA confirmation code 168920160323094307.

koscejev avatar Mar 23 '16 22:03 koscejev

Please can you merge?

cipous avatar Oct 03 '16 12:10 cipous

Thanks @dodecaedro for rebase.

koscejev avatar Jan 06 '17 20:01 koscejev

Thanks to you for your work on it.

Now could someone please merge the pull request? Thank you.

jbequinn avatar Jan 06 '17 22:01 jbequinn

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

a-mujthaba321 avatar Dec 03 '17 15:12 a-mujthaba321