I have a DTO with a couple fields, username, password and email All of them Strings.
I also have a List that I want as an optional, meaning it does not have to be passed in from the form and can be left blank.
This should be valid from the front-end:
{
"username":"user",
"email":"email@email.com",
"password": "123",
"hobbies":[ "Weightlifting", "Dancing"]
}
So should this:
{
"username":"user",
"email":"email@email.com",
"password": "123"
}
Is there any @OptionalField annotation or the likes within javax.validation.constraints?
Or is my only option two seperate DTOs?