diff --git a/server/config/index.js b/server/config/index.js index a00a33d..f2917a3 100644 --- a/server/config/index.js +++ b/server/config/index.js @@ -1,11 +1,8 @@ 'use strict'; -const { pluginConfigSchema } = require('./schema'); +const schema = require('./schema'); module.exports = { - async validator(config) { - await pluginConfigSchema.validate(config); - }, default: () => ({ contentTypes: {}, slugifyOptions: {}, @@ -13,4 +10,5 @@ module.exports = { shouldUpdateSlug: false, skipUndefinedReferences: false, }), + validator: (config) => schema.validateSync(config), }; diff --git a/server/config/schema.js b/server/config/schema.js index f4f0074..8ee5f73 100644 --- a/server/config/schema.js +++ b/server/config/schema.js @@ -3,7 +3,7 @@ const yup = require('yup'); const _ = require('lodash'); -const pluginConfigSchema = yup.object().shape({ +const schema = yup.object().shape({ slugifyOptions: yup.object(), contentTypes: yup.lazy((obj) => { let shape = {}; @@ -22,6 +22,4 @@ const pluginConfigSchema = yup.object().shape({ skipUndefinedReferences: yup.bool(), }); -module.exports = { - pluginConfigSchema, -}; +module.exports = schema;