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(
88
88
operationName: String ? = nil ,
89
89
validationRules: [ @Sendable ( ValidationContext ) -> Visitor ] = specifiedRules
90
90
) 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
91
98
let source = Source ( body: request, name: " GraphQL request " )
92
99
let documentAST = try parse ( source: source)
100
+
101
+ // Validate
93
102
let validationErrors = validate (
94
103
schema: schema,
95
104
ast: documentAST,
96
105
rules: validationRules
97
106
)
98
-
99
107
guard validationErrors. isEmpty else {
100
108
return GraphQLResult ( errors: validationErrors)
101
109
}
102
110
111
+ // Execute
103
112
return try await execute (
104
113
schema: schema,
105
114
documentAST: documentAST,
You can’t perform that action at this time.
0 commit comments