You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Depending on context, I would like to either send the user the entire dto, or just a subset of its attributes. Eg.
Describe the solution you'd like
Example:
class User {
@JsonView({Views.Basic, Views.Extended, Views.Admin})
String username;
@JsonView(Views.Admin);
String password;
@JsonViews(Views.Extended)
Object[] userSettings;
}
class AdminEndpoint{
// Admin may see password (or some other privileged field)
@JsonView(Views.Admin)
User getUser(){
service.getUser();
}
}
class UserEndpoint{
// When querying a single user, also retrieve the userSettings (which may be many)
@JsonView(Views.Extended)
User getUser(){
service.getUser();
}
// When retrieving lists, stick to the basics like id, username etc
@JsonView(Views.Basic)
List<User> getAllUsers(){
service.getAllUsers();
}
}
Describe alternatives you've considered
One could define separate DTOs for each use case. This is rather burdensome, and JsonView is a widely accepted solution in the Spring ecosystem.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Depending on context, I would like to either send the user the entire dto, or just a subset of its attributes. Eg.
Describe the solution you'd like
Example:
Describe alternatives you've considered
One could define separate DTOs for each use case. This is rather burdensome, and JsonView is a widely accepted solution in the Spring ecosystem.
The text was updated successfully, but these errors were encountered: