Skip to content
This repository has been archived by the owner on Aug 8, 2018. It is now read-only.

Commit

Permalink
[common] fix(schema-validator): validation error logged to console ra…
Browse files Browse the repository at this point in the history
…ther thrown
  • Loading branch information
lxgreen committed Jul 11, 2018
1 parent d13d90e commit 1a9d24e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/common/src/Utils/component-data-validator.js
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
export const validate = () => true;
import { Validator } from 'jsonschema';

const validator = new Validator();

export const validate = (componentData, schema) => {
const result = validator.validate(componentData, schema);
if (!result.valid && result.errors) {
result.errors.forEach(error => console.warn('Plugin schema validation error:', error)); // eslint-disable-line no-console
}
};

0 comments on commit 1a9d24e

Please sign in to comment.