blaze-persistence icon indicating copy to clipboard operation
blaze-persistence copied to clipboard

FR: Support field-EntityView deserializatin for DTOs which are non-entity views

Open EugenMayer opened this issue 1 year ago • 0 comments

With EntityViewAwareMappingJackson2HttpMessageConverter BP supports (de)serialization of EntityViews (currently in MVC context only).

This only works, when the actual top-level type is an EntityView such as

@EntityView
class GroupIdView {
   public UserIdView member;
}

this will work for the top-level type GroupIdView and the field member of type UserIdView

When submitting an dto like

record GroupDTO (public UserIdView member){};

This will not work, since GroupDTO is not a EntityView, thus it will be handled by the generic MappingJackson2HttpMessageConverter which will fail to deserialize member since the type is an interface.

This FR suggest that we add deserializtion support for DTO's too. As discussed with @beikov this can be done by re-implementing canRead to act if it is an EV OR if call super().canRead() opts in.

EugenMayer avatar Apr 26 '24 12:04 EugenMayer