I\'m creating a Spring-Boot microservice REST API that expects @RequestParam of type List. How can I validate that the list contains
As per Bean Validator 2.0, Hibernate Validator 6.x, you can use constraints directly on parameterized type.
@GetMapping(path = "/myApi", produces = { APPLICATION_JSON_VALUE })
public ResponseEntity> getSomething(@RequestParam(value = "programEndTime", required = false) List<@Size(min = 1, max = 2) String> programEndTimes)
For more information, check out Container element constraints.