I have the following:
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<LoginResponse> getLoginStatus(@Valid LoginRequest loginRequest){
//some stuff here
}
The loginRequest
paramater is a @RequestParam
, but, because it is a custom object, the @RequestParam
annotation in front of the object is not needed. The problem is that when any bean-validation annotation is put in front of the custom object, the object is transformed into a body parameter(@RequestBody
), but we want to validate the object as request param, not body param.
Could anyone help me, please?
The reason why the LoginRequest
attributes became part of the RequestBody
, and not of RequestParameters
anymore, is due to springfox-swagger
version 2.6.1. Upgrading to version 2.7.0 fixed this issue for us.