Beispiel #1
0
        // This method is here only because of graphiql explorer!!! Should be done in another way, but I'm too lazy for it.
        // This works for now!!! :) :P
        // To avoid this we should create GraphQLController  and make GraphiQL Explorer call the controller endpoint
        private GraphiQlRequest TryDeserializeGraphiQlRequest(string query)
        {
            GraphiQlRequest request = null;

            try
            {
                request = JsonConvert.DeserializeObject <GraphiQlRequest>(query);
            }
            catch (Exception)
            {
                // muahahahhaha does nothing! Surprise :)
            }

            return(request);
        }
Beispiel #2
0
        private async Task <ExecutionResult> FilterRequest(GraphiQlRequest request, string query)
        {
            if (request != null)
            {
                return(await new DocumentExecuter().ExecuteAsync(options =>
                {
                    options.Schema = this.Schema;
                    options.Query = request.Query;
                    options.OperationName = request.OperationName;
                    options.Inputs = request.Variables.ToInputs();
                }));
            }

            return(await new DocumentExecuter().ExecuteAsync(options =>
            {
                options.Schema = this.Schema;
                options.Query = query;
            }));
        }