From c48e13fb0d1204834d9de068de08e30a5860b9fd Mon Sep 17 00:00:00 2001 From: daedalus <44623501+ComfortablyCoding@users.noreply.github.com> Date: Mon, 24 Oct 2022 01:14:27 -0400 Subject: [PATCH] refactor(config/validator): make validation sync refactor(config/validator): convert to arrow function for consistency --- server/config/index.js | 6 ++---- server/config/schema.js | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) 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;