Open jack828 opened 3 years ago
If validators is an array, always run regardless of specified set (because using an array is a shorthand for { all: [...] }) If validators is an object, use the specified set validator, if it doesn't exist, fall back and use the all validator.
{ all: [...] }
all
Use case:
firstName: { type: String, validators: { all: [required] } }, lastName: { type: String, validators: [required] }, agency: { type: String, validators: { test: [required] } },
In schemata's current state, if you validate {} with the test set, it will only fail validation on agency field.
{}
test
agency
With these changes, it will correctly fail on all fields.
If you need to disable a validator field, you simply:
agency: { type: String, validators: { all: [], test: [required] } },
Or just omit validators
validators
If validators is an array, always run regardless of specified set (because using an array is a shorthand for
{ all: [...] }
) If validators is an object, use the specified set validator, if it doesn't exist, fall back and use theall
validator.Use case:
In schemata's current state, if you validate
{}
with thetest
set, it will only fail validation onagency
field.With these changes, it will correctly fail on all fields.
If you need to disable a validator field, you simply:
Or just omit
validators