I have a request WorkerRequest in which there is an enum which has FULL_TIME, MANAGER and so on.
In WorkerRequest how can I apply the length validation on this enum?
Example: enum type should not be greater than 8 characters.
FULL_TIME valid (8 characters)
PERMANENT invalid (9 characters)
Currently if I put javax.validation.constraints.Size
@Size(min = 0, max = 8, message = "Allowed length for workerType is 8.")
@Enumerated(EnumType.STRING)
private WorkerType workerType;
it throws an error :
HV000030: No validator could be found for constraint 'javax.validation.constraints.Size' validating type 'com.XX.XX.XX.WorkerType'. Check configuration for 'workerType'