1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var graphql_1 = require("graphql");
|
4 | var effectiveRules = graphql_1.specifiedRules.filter(function (f) { return f.name !== 'NoUnusedFragments'; });
|
5 | var IGNORED_VALIDATION_ERRORS = ['Unknown fragment', 'Unknown directive'];
|
6 | exports.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 |
|
\ | No newline at end of file |