Repository navigation
Commit dd60198
committed
Make SchemaValidator a single pass over types instead of a SchemaTraverser walk
SchemaValidator now applies its rules by iterating the schema's types and
directive definitions directly, instead of running ten GraphQLTypeVisitor
rules over every schema element with SchemaTraverser. validateSchema keeps
the same signature; getRules() and the rule visitor classes are removed.
Behaviour differences:
- errors are reported grouped by type, so their order changes
- elements shared between several parents are checked under each of them,
where the traversal only checked them under the first parent it reached
- schemas whose programmatic default values form a cycle now fail with an
InvalidSchemaException instead of a StackOverflowError
On large-schema-4 validation drops from ~407ms to ~16ms and allocation from
~532MB to ~12MB per run (SchemaValidatorBenchmark).1 parent e1253c6 commit dd60198
24 files changed
Lines changed: 1414 additions & 1675 deletions
File tree
- src
- jmh/java/benchmark
- main/java/graphql/schema/validation
- test/groovy/graphql
- archunit
- schema
- validation
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments