I have a pretty simple REST API project using Spring Boot 1.5.7 and Jackson 2.8.
Problem
I want Jackson to complain and raise an exception if there is an unknown field in the request. Although I have not set up anything telling it to ignore them, it simply ignores it and I do not know why.
Request:
{
"appId":1,
"version":"1.0",
"status":true,
"locked":false,
"field": "it is ignored, but it must not be"
}
Requet method
@PutMapping
public ResponseEntity<?> updateAppToggle(@RequestBody AppToggleUpdateRequest request) {
AppToggle updatedAppToggle = service.update(request);
return new ResponseEntity<AppToggleResponse>
(AppToggleResponse.fillResponse(updatedAppToggle), HttpStatus.OK);
}
Request class
@Data
public class AppToggleUpdateRequest {
@NotNull
@Getter
private Long appId;
@NotNull
@Getter
private String version;
private Boolean status;
private Boolean locked;
}
My application.properties does not contain anything special, just datasource and a few stuff for H2 in-memory database.
I really do not know what is going on. Any help would be truly appreciated.