Exemplo n.º 1
0
    ResolveFieldContext GetContext(ExecutionContext context, ExecutionNode node)
    {
        var argumentValues = ExecutionHelper.GetArgumentValues(context.Schema,
                                                               node.FieldDefinition.Arguments, node.Field.Arguments, context.Variables);
        var dictionary = ExecutionHelper.SubFieldsFor(context, node.FieldDefinition.ResolvedType, node.Field);

        return(new ResolveFieldContext
        {
            FieldName = node.Field.Name,
            FieldAst = node.Field,
            FieldDefinition = node.FieldDefinition,
            ReturnType = node.FieldDefinition.ResolvedType,
            ParentType = node.GetParentType(context.Schema),
            Arguments = argumentValues,
            Source = node.Source,
            Schema = context.Schema,
            Document = context.Document,
            Fragments = context.Fragments,
            RootValue = context.RootValue,
            UserContext = context.UserContext,
            Operation = context.Operation,
            Variables = context.Variables,
            CancellationToken = context.CancellationToken,
            Metrics = context.Metrics,
            Errors = context.Errors,
            Path = node.Path,
            SubFields = dictionary
        });
    }
 private IDictionary <string, Field> GetSubFields()
 => ExecutionHelper.SubFieldsFor(_executionContext, _executionNode.FieldDefinition.ResolvedType, _executionNode.Field);