Added joi plugin validation

This commit is contained in:
Wyatt Johnson
2017-04-06 10:39:36 -06:00
parent e70cfdfd00
commit 1f367e666b
10 changed files with 54 additions and 0 deletions
+3
View File
@@ -3,6 +3,7 @@
// this change is done now everything will likely break on the front end.
const fs = require('fs');
const Joi = require('joi');
const path = require('path');
const {mergeStrings} = require('gql-merge');
const debug = require('debug')('talk:graph:typeDefs');
@@ -20,6 +21,8 @@ const typeDefs = mergeStrings([
// Load the plugin definitions from the manager.
...plugins.get('server', 'typeDefs').map(({plugin, typeDefs}) => {
Joi.assert(typeDefs, Joi.string(), `Plugin '${plugin.name}' had an error loading the typeDefs`);
debug(`added plugin '${plugin.name}'`);
return typeDefs;