Skip to content
This repository has been archived by the owner on Sep 10, 2019. It is now read-only.

Commit

Permalink
feat: check data sources for required properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jlengstorf committed Dec 18, 2017
1 parent d126dc5 commit 34d1614
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/data-sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ const loadDataSourceFromPath = dataSourcePath => {
const src = require(dataSourcePath);
const dataSource = src.default || src;

// TODO check for required properties.
if (!dataSource.namespace || !dataSource.context || !dataSource.typeDefs) {
error([
`Error: this data source is missing required properties:`,
dataSourcePath,
]);

throw new Error('Invalid data source.');
}

log(` -> successfully loaded ${dataSource.namespace}`);

Expand Down

0 comments on commit 34d1614

Please sign in to comment.