mirror of
https://github.com/strapi/strapi.git
synced 2025-07-23 09:00:19 +00:00
21 lines
455 B
JavaScript
21 lines
455 B
JavaScript
'use strict';
|
|
|
|
const { yup, formatYupErrors } = require('strapi-utils');
|
|
|
|
const handleReject = error => Promise.reject(formatYupErrors(error));
|
|
|
|
const roleUpdateSchema = yup
|
|
.object()
|
|
.shape({
|
|
description: yup.string().nullable(),
|
|
})
|
|
.noUnknown();
|
|
|
|
const validateRoleUpdateInput = data => {
|
|
return roleUpdateSchema.validate(data, { strict: true, abortEarly: false }).catch(handleReject);
|
|
};
|
|
|
|
module.exports = {
|
|
validateRoleUpdateInput,
|
|
};
|