Merge branch 'master' of github.com:trouble/payload into slate-js

This commit is contained in:
Jarrod Flesch
2020-06-04 15:14:35 -04:00
46 changed files with 820 additions and 336 deletions

View File

@@ -9,7 +9,7 @@ const validateUpdate = async (data, fields) => {
const field = fields.find(matchedField => matchedField.name === key);
if (field && dataToValidate) {
if (field && dataToValidate !== undefined) {
validationPromises.push(field.validate(dataToValidate, field));
validatedFields.push(field);
}

View File

@@ -27,7 +27,11 @@ const optionsToValidatorMap = {
return `This value must be longer than the minimum length of ${options.max} characters.`;
}
return Boolean(value);
if (typeof value !== 'string' || value.length === 0) {
return 'This field is required.';
}
return true;
},
password: (value, options = {}) => {
if (options.maxLength && value.length > options.maxLength) {