I have following user details model that is used in POST & PUT controllers of /user resource.
public class UserDetails {
    @NotBlank
    private String username;
    @NotBlank
    private String password;
    @NotBlank
    private String firstName;
    @NotBlank
    private String lastName;
    @NotBlank
    private String nic;
    @NotNull
    private Integer roleId;
    
    // constructor & getters setters
}
@PostMapping("/org/employee")
public void createEmployee(@RequestBody EmployeeDetailsModel empDetails) {
    employeeService.createUser(empDetails);
}
@PutMapping("/org/employee")
public void updateEmployee(@RequestBody EmployeeDetailsModel empDetails) {
    employeeService.updateUser(empDetails);
}
Here, UserDetails has @NotNull & @NotBlank validations. POST would work fine because to create a user, all details are mandatory. But when updating with PUT, I don't need all properties of UserDetails to be filled.
So my questions are,
- How this kind of scenarios are handled? Do we usually force clients to send all those details whether they are changed or not?
- Is it possible to disable request body validation just for a particular endpoint or do I have to create separate model that looks the same but without validations?
 
    