From ee88ea9c4277bad6d7c8a883374f14b8c765601d Mon Sep 17 00:00:00 2001 From: Kim de Vos Date: Thu, 14 Jun 2018 14:24:00 +0200 Subject: [PATCH] Added missing context as parameter to Schema.execute --- Sources/Graphiti/Schema/Schema.swift | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Sources/Graphiti/Schema/Schema.swift b/Sources/Graphiti/Schema/Schema.swift index 09800a12..d76bba03 100644 --- a/Sources/Graphiti/Schema/Schema.swift +++ b/Sources/Graphiti/Schema/Schema.swift @@ -550,4 +550,46 @@ public struct Schema { operationName: operationName ) } + + public func execute( + request: String, + context: Context, + eventLoopGroup: EventLoopGroup, + variables: [String: Map] = [:], + operationName: String? = nil + ) throws -> EventLoopFuture { + guard Root.self is Void.Type else { + throw GraphQLError( + message: "Root value is required." + ) + } + + return try graphql( + schema: schema, + request: request, + context: context, + eventLoopGroup: eventLoopGroup, + variableValues: variables, + operationName: operationName + ) + } + + public func execute( + request: String, + rootValue: Root, + context: Context, + worker: EventLoopGroup, + variables: [String: Map] = [:], + operationName: String? = nil + ) throws -> EventLoopFuture { + return try graphql( + schema: schema, + request: request, + rootValue: rootValue, + context: context, + eventLoopGroup: worker, + variableValues: variables, + operationName: operationName + ) + } }