mirror of
https://github.com/ComfortablyCoding/strapi-plugin-slugify.git
synced 2025-12-21 00:01:49 -05:00
26 lines
608 B
JavaScript
26 lines
608 B
JavaScript
'use strict';
|
|
|
|
const yup = require('yup');
|
|
const _ = require('lodash');
|
|
|
|
const schema = yup.object().shape({
|
|
slugifyOptions: yup.object(),
|
|
contentTypes: yup.lazy((obj) => {
|
|
let shape = {};
|
|
_.each(obj, (_value, key) => {
|
|
shape[key] = yup.object().shape({
|
|
field: yup.string().required(),
|
|
references: yup.lazy((v) =>
|
|
_.isArray(v) ? yup.array().of(yup.string()).required() : yup.string().required()
|
|
),
|
|
});
|
|
});
|
|
return yup.object().shape(shape);
|
|
}),
|
|
slugifyWithCount: yup.bool(),
|
|
shouldUpdateSlug: yup.bool(),
|
|
skipUndefinedReferences: yup.bool(),
|
|
});
|
|
|
|
module.exports = schema;
|