33
44import graphql .language .Argument ;
55import graphql .language .Node ;
6+ import graphql .language .TypeName ;
67import graphql .validation .rules .ArgumentsOfCorrectType ;
8+ import graphql .validation .rules .DefaultValuesOfCorrectType ;
9+ import graphql .validation .rules .KnownTypeNames ;
10+ import graphql .validation .rules .ScalarLeafs ;
711
812import java .util .ArrayList ;
913import java .util .List ;
@@ -15,7 +19,22 @@ public class RulesVisitor implements QueryLanguageVisitor {
1519
1620 public RulesVisitor (ValidationContext validationContext ) {
1721 this .validationContext = validationContext ;
18- rules .add (new ArgumentsOfCorrectType (validationContext ));
22+
23+ ArgumentsOfCorrectType argumentsOfCorrectType = new ArgumentsOfCorrectType ();
24+ argumentsOfCorrectType .setValidationContext (validationContext );
25+ rules .add (argumentsOfCorrectType );
26+
27+ KnownTypeNames knownTypeNames = new KnownTypeNames ();
28+ knownTypeNames .setValidationContext (validationContext );
29+ rules .add (knownTypeNames );
30+
31+ DefaultValuesOfCorrectType defaultValuesOfCorrectType = new DefaultValuesOfCorrectType ();
32+ defaultValuesOfCorrectType .setValidationContext (validationContext );
33+ rules .add (defaultValuesOfCorrectType );
34+
35+ ScalarLeafs scalarLeafs = new ScalarLeafs ();
36+ scalarLeafs .setValidationContext (validationContext );
37+ rules .add (scalarLeafs );
1938 }
2039
2140 @ Override
@@ -25,6 +44,10 @@ public void enter(Node node) {
2544 for (AbstractRule rule : rules ) {
2645 rule .checkArgument ((Argument ) node );
2746 }
47+ } else if (node instanceof TypeName ) {
48+ for (AbstractRule rule : rules ) {
49+ rule .checkTypeName ((TypeName ) node );
50+ }
2851 }
2952 }
3053
0 commit comments