-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
validator that only proceeds if the data key exists, only useful for maps
ie
input = %{
name: "joe"
}
rules = %{
name: [type: :string],
age: [sometimes: true, min: 18]
}
# passes because age isn't present in input, so no validations are ran for age
{:ok, data} = Validate.validate(input, rules)
input = %{
name: "joe",
age: 15
}
# now the `min` validator runs because age is present in the input
{:error, errors} = Validate.validate(input, rules)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels