Exemplo n.º 1
0
        public FieldCollectionResult CollectFields(
            INamedOutputType type,
            SelectionSetNode selectionSet,
            Path path)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (selectionSet == null)
            {
                throw new ArgumentNullException(nameof(selectionSet));
            }

            var fields = new OrderedDictionary <string, FieldSelection>();
            var root   = new FragmentNode();

            CollectFields(type, selectionSet, path, fields, root);

            return(new FieldCollectionResult(
                       type,
                       selectionSet,
                       fields.Values.ToList(),
                       root.Children));
        }
Exemplo n.º 2
0
        public FragmentNode AddChild(Fragment fragment)
        {
            var child = new FragmentNode(fragment);

            Children.Add(child);
            return(child);
        }
Exemplo n.º 3
0
 private void ResolveFields(
     INamedOutputType type,
     ISelectionNode selection,
     Path path,
     IDictionary <string, FieldSelection> fields,
     FragmentNode parent)
 {
     if (selection is FieldNode fs && type is IComplexOutputType ct)
     {
         ResolveFieldSelection(
             ct,
             fs,
             path,
             fields);
     }
Exemplo n.º 4
0
 private void CollectFields(
     INamedOutputType type,
     SelectionSetNode selectionSet,
     Path path,
     IDictionary <string, FieldSelection> fields,
     FragmentNode parent)
 {
     foreach (ISelectionNode selection in selectionSet.Selections)
     {
         ResolveFields(
             type,
             selection,
             path,
             fields,
             parent);
     }
 }