@graphql-inspector/core
Advanced tools
Comparing version 1.21.0 to 1.22.0
@@ -10,3 +10,4 @@ import { GraphQLSchema, GraphQLError, Source } from 'graphql'; | ||
strictDeprecated?: boolean; | ||
maxDepth?: number; | ||
} | ||
export declare function validate(schema: GraphQLSchema, sources: Source[], options?: ValidateOptions): InvalidDocument[]; |
@@ -18,2 +18,3 @@ "use strict"; | ||
var graphql_2 = require("../utils/graphql"); | ||
var query_depth_1 = require("./query-depth"); | ||
function validate(schema, sources, options) { | ||
@@ -66,3 +67,14 @@ var config = __assign({ strictDeprecated: true, strictFragments: true }, options); | ||
}; | ||
var errors = graphql_1.validate(schema, merged); | ||
var errors = graphql_1.validate(schema, merged) || []; | ||
if (config.maxDepth) { | ||
var depthError = query_depth_1.validateQueryDepth({ | ||
source: doc.source, | ||
doc: merged, | ||
maxDepth: config.maxDepth, | ||
fragmentGraph: graph, | ||
}); | ||
if (depthError) { | ||
errors.push(depthError); | ||
} | ||
} | ||
var deprecated = config.strictDeprecated | ||
@@ -69,0 +81,0 @@ ? graphql_2.findDeprecatedUsages(schema, graphql_1.parse(doc.source.body)) |
{ | ||
"name": "@graphql-inspector/core", | ||
"version": "1.21.0", | ||
"version": "1.22.0", | ||
"description": "Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types.", | ||
@@ -36,9 +36,9 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/graphql": "14.2.1", | ||
"@types/jest": "24.0.13", | ||
"@types/graphql": "14.2.2", | ||
"@types/jest": "24.0.15", | ||
"graphql-tag": "2.10.1", | ||
"jest": "24.8.0", | ||
"ts-jest": "24.0.2", | ||
"typescript": "3.5.1" | ||
"typescript": "3.5.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
888674
92
2030