22 lines
487 B
JavaScript
Raw Normal View History

'use strict';
2021-04-29 13:51:12 +02:00
const { yup, formatYupErrors } = require('@strapi/utils');
const handleReject = error => Promise.reject(formatYupErrors(error));
const roleUpdateSchema = yup
.object()
.shape({
name: yup.string().min(1),
description: yup.string().nullable(),
})
.noUnknown();
const validateRoleUpdateInput = data => {
return roleUpdateSchema.validate(data, { strict: true, abortEarly: false }).catch(handleReject);
};
module.exports = {
validateRoleUpdateInput,
};