We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 52ba554 commit fbe4e57Copy full SHA for fbe4e57
README.md
@@ -229,11 +229,14 @@ This package exposes 3 additional functionalities which comprise the internals o
229
230
```ts
231
import { typeWeightsFromSchema } from 'graphql-limiter';
232
- import { parse } from 'graphql';
+ import { parse, validate } from 'graphql';
233
234
let queryAST: DocumentNode = parse(`...`);
235
236
const queryParser: ASTParser = new ComplexityAnalysis(typeWeights, variables);
237
+
238
+ // query must be validatied against the schema before processing the query
239
+ const validationErrors = validate(schema, queryAST);
240
241
const complexity: number = queryParser.processQuery(queryAST);
242
```
0 commit comments