UNPKG

805 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var graphql_1 = require("graphql");
4var effectiveRules = graphql_1.specifiedRules.filter(function (f) { return f.name !== 'NoUnusedFragments'; });
5var IGNORED_VALIDATION_ERRORS = ['Unknown fragment', 'Unknown directive'];
6exports.validateGraphQlDocuments = function (schema, documentFiles) {
7 return documentFiles
8 .map(function (result) { return ({
9 filePath: result.filePath,
10 errors: graphql_1.validate(schema, result.content, effectiveRules).filter(function (e) { return !IGNORED_VALIDATION_ERRORS.find(function (ignoredErr) { return e.message.indexOf(ignoredErr) > -1; }); })
11 }); })
12 .filter(function (r) { return r.errors.length > 0; });
13};
14//# sourceMappingURL=validate-documents.js.map
\No newline at end of file