Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
EugenMayer opened this issue Apr 26, 2024 · 0 comments

Comments

@EugenMayer
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants