@@ -64,28 +64,31 @@ public Task<INodeVisitor> ValidateAsync(ValidationContext context)
6464
6565 private bool SkipAuthCheck ( Field fieldAst , ValidationContext context )
6666 {
67- if ( fieldAst . Directives == null || ! fieldAst . Directives . Any ( ) ) return true ;
67+ if ( fieldAst . Directives == null || ! fieldAst . Directives . Any ( ) ) return false ;
6868
69- var includeField = GetDirectiveValue ( context , fieldAst . Directives , DirectiveGraphType . Include . Name ) ;
69+ var includeField = GetDirectiveValue ( context , fieldAst . Directives , DirectiveGraphType . Include ) ;
7070 if ( includeField . HasValue ) return ! includeField . Value ;
7171
72- var skipField = GetDirectiveValue ( context , fieldAst . Directives , DirectiveGraphType . Skip . Name ) ;
72+ var skipField = GetDirectiveValue ( context , fieldAst . Directives , DirectiveGraphType . Skip ) ;
7373 if ( skipField . HasValue ) return skipField . Value ;
7474
7575 return false ;
7676 }
7777
78- private static bool ? GetDirectiveValue ( ValidationContext context , Directives directives , string directiveName )
78+ private static bool ? GetDirectiveValue ( ValidationContext context , Directives directives , DirectiveGraphType directiveType )
7979 {
80- var directive = directives . Find ( directiveName ) ;
80+ var directive = directives . Find ( directiveType . Name ) ;
8181 if ( directive == null ) return null ;
8282
83- var operation = ! string . IsNullOrWhiteSpace ( context . OperationName )
84- ? context . Document . Operations . WithName ( context . OperationName )
85- : context . Document . Operations . FirstOrDefault ( ) ;
83+ var operationName = context . OperationName ;
84+ var documentOperations = context . Document . Operations ;
85+ var operation = ! string . IsNullOrWhiteSpace ( operationName )
86+ ? documentOperations . WithName ( operationName )
87+ : documentOperations . FirstOrDefault ( ) ;
88+
8689 var values = ExecutionHelper . GetArgumentValues (
8790 context . Schema ,
88- DirectiveGraphType . Include . Arguments ,
91+ directiveType . Arguments ,
8992 directive . Arguments ,
9093 ExecutionHelper . GetVariableValues ( context . Document , context . Schema , operation ? . Variables , context . Inputs ) ) ;
9194
0 commit comments