Skip to content
This repository was archived by the owner on Sep 16, 2025. It is now read-only.

Commit c48e13f

Browse files
refactor(config/validator): make validation sync
refactor(config/validator): convert to arrow function for consistency
1 parent d44577e commit c48e13f

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

server/config/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
'use strict';
22

3-
const { pluginConfigSchema } = require('./schema');
3+
const schema = require('./schema');
44

55
module.exports = {
6-
async validator(config) {
7-
await pluginConfigSchema.validate(config);
8-
},
96
default: () => ({
107
contentTypes: {},
118
slugifyOptions: {},
129
slugifyWithCount: false,
1310
shouldUpdateSlug: false,
1411
skipUndefinedReferences: false,
1512
}),
13+
validator: (config) => schema.validateSync(config),
1614
};

server/config/schema.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const yup = require('yup');
44
const _ = require('lodash');
55

6-
const pluginConfigSchema = yup.object().shape({
6+
const schema = yup.object().shape({
77
slugifyOptions: yup.object(),
88
contentTypes: yup.lazy((obj) => {
99
let shape = {};
@@ -22,6 +22,4 @@ const pluginConfigSchema = yup.object().shape({
2222
skipUndefinedReferences: yup.bool(),
2323
});
2424

25-
module.exports = {
26-
pluginConfigSchema,
27-
};
25+
module.exports = schema;

0 commit comments

Comments
 (0)