public void BuildSchemas() { var rootTypes = _assemblyResolver.GetRootTypes(); foreach (var rootType in rootTypes) { var mutationTypes = _assemblyResolver.GetMutationTypes(rootType); var subscriptionTypes = _assemblyResolver.GetSubscriptionTypes(rootType); var schema = new DynamicSchema(_graphQlTypePool, rootType, mutationTypes, subscriptionTypes, _intializers); _rootTypeSchema.Add(rootType, schema); } }
private async Task ExecuteAsync(HttpContext context, ISchema schema) { var request = Deserialize <GraphQLRequest>(context.Request.Body); var result = await _executer.ExecuteAsync(_ => { // The current thinking is to make these dependent of some of the Ubigia directives provided by the query. // First we need to know the document to know where to start path traversal. // This should not have any consequences for the further execution. _.Document = _builder.Build(request.Query); // We do this by always returning a dynamic schema which includes everything from the static schema. // _.Schema = DynamicSchema.Create(schema, request.Query); _.Schema = DynamicSchema.Create(schema, _.Document); _.Query = request.Query; _.OperationName = request.OperationName; _.Inputs = request.Variables.ToInputs(); _.UserContext = _settings.BuildUserContext?.Invoke(context); }); await WriteResponseAsync(context, result); }