1

The @Valid request object for my Jersey 2 REST service has a List<String> of ids as a field, which I'm trying to validate against a pattern? I've tried something like the following...

public class MyRequestObject {

    @NotNull
    @Pattern( regexp = Patterns.MY_ID_PATTERN )
    private List<String> ids;

}

...which is giving me the error when calling the service:

javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type: java.util.List<java.lang.String>.

Will I need to build a custom validator or is there a way to validate against a list of elements?

Fergal
  • 5,213
  • 6
  • 35
  • 44

0 Answers0