-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
I am having trouble using vex to validate a field in a struct that consists of a list of values.
For example If I have the following struct:
user = %{emails_list: ["correct@email.com","incorrect@email"]}
and then I use vex.valid? to validate the emails:
Vex.valid?(user,
emails_list: [
presence: [message: "can't be empty"],
format: [
with: ~r/\S+@\S+\.\S+/,
allow_nil: false,
allow_blank: false,
string: true,
message: "can't be empty"
]
]
)
I am getting True back even though one of the emails in the list is invalid. To verify I tested it the values without the list and it is returning the correct validation result.
Is it possible to validate a struct with a list as one of its fields? Or do I have to write a validator with a custom function to map over each value in the list to validate it?
metehan, silvadanilo, scottming and antoinereyt
Metadata
Metadata
Assignees
Labels
No labels