File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -88,18 +88,27 @@ public func graphql(
8888    operationName:  String ? =  nil , 
8989    validationRules:  [ @Sendable   ( ValidationContext )  ->  Visitor ]  =  specifiedRules
9090)  async  throws  ->  GraphQLResult  { 
91+     // Validate schema
92+     let  schemaValidationErrors  =  try validateSchema ( schema:  schema) 
93+     guard  schemaValidationErrors. isEmpty else  { 
94+         return  GraphQLResult ( errors:  schemaValidationErrors) 
95+     } 
96+ 
97+     // Parse
9198    let  source  =  Source ( body:  request,  name:  " GraphQL request " ) 
9299    let  documentAST  =  try parse ( source:  source) 
100+ 
101+     // Validate
93102    let  validationErrors  =  validate ( 
94103        schema:  schema, 
95104        ast:  documentAST, 
96105        rules:  validationRules
97106    ) 
98- 
99107    guard  validationErrors. isEmpty else  { 
100108        return  GraphQLResult ( errors:  validationErrors) 
101109    } 
102110
111+     // Execute
103112    return  try await  execute ( 
104113        schema:  schema, 
105114        documentAST:  documentAST, 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments