@digicms/cms
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite
24 lines (19 loc) • 562 B
JavaScript
;
const { yup } = require('@strapi/utils');
const componentSchemaValidator = () =>
yup.object().shape({
info: yup
.object()
.shape({
singularName: yup.string().isCamelCase().required(),
pluralName: yup.string().isCamelCase().required(),
displayName: yup.string().required(),
})
.required(),
});
const validateComponentDefinition = (data) => {
return componentSchemaValidator.validateSync(data, { strict: true, abortEarly: false });
};
module.exports = {
validateComponentDefinition,
};