mirror of
https://github.com/strapi/strapi.git
synced 2025-07-23 00:51:17 +00:00
21 lines
444 B
JavaScript
21 lines
444 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(),
|
||
|
})
|
||
|
.noUnknown();
|
||
|
|
||
|
const validateRoleUpdateInput = data => {
|
||
|
return roleUpdateSchema.validate(data, { strict: true, abortEarly: false }).catch(handleReject);
|
||
|
};
|
||
|
|
||
|
module.exports = {
|
||
|
validateRoleUpdateInput,
|
||
|
};
|