protected override void VisitObjectTypeDefinition(
            ObjectTypeDefinitionNode node,
            DocumentWriter writer)
        {
            WriteDescription(node.Description, writer);

            writer.Write(Keywords.Type);
            writer.WriteSpace();
            writer.WriteName(node.Name);

            if (node.Interfaces.Count > 0)
            {
                writer.WriteSpace();
                writer.Write(Keywords.Implements);
                writer.WriteSpace();
                writer.WriteMany(node.Interfaces,
                                 (n, w) => writer.WriteNamedType(n),
                                 " & ");
            }

            WriteDirectives(node.Directives, writer);

            WriteLeftBrace(writer);

            writer.Indent();
            writer.WriteMany(
                node.Fields,
                VisitFieldDefinition,
                WriteLineOrSpace);
            writer.Unindent();

            WriteRightBrace(writer);
        }
 protected override void VisitObjectTypeDefinition(
     ObjectTypeDefinitionNode node,
     object context)
 {
     _visited.Add(nameof(VisitObjectTypeDefinition));
     base.VisitObjectTypeDefinition(node, context);
 }
Exemplo n.º 3
0
        protected virtual void ResolveChildren(
            ObjectTypeDefinitionNode node,
            IList <SyntaxNodeInfo> children)
        {
            ResolveChildren(
                nameof(node.Description),
                node.Description,
                children);

            ResolveChildren(
                nameof(node.Name),
                node.Name,
                children);

            ResolveChildren(
                nameof(node.Interfaces),
                node.Interfaces,
                children);

            ResolveChildren(
                nameof(node.Directives),
                node.Directives,
                children);

            ResolveChildren(
                nameof(node.Fields),
                node.Fields,
                children);
        }
Exemplo n.º 4
0
        protected virtual ObjectTypeDefinitionNode RewriteObjectTypeDefinition(
            ObjectTypeDefinitionNode node,
            TContext context)
        {
            ObjectTypeDefinitionNode current = node;

            current = RewriteDirectives(current, current.Directives,
                                        context, current.WithDirectives);

            current = Rewrite(current, current.Name, context,
                              RewriteName, current.WithName);

            if (current.Description is not null)
            {
                current = Rewrite(current, current.Description, context,
                                  RewriteStringValue, current.WithDescription);
            }

            current = RewriteMany(current, current.Interfaces, context,
                                  RewriteNamedType, current.WithInterfaces);

            current = RewriteMany(current, current.Fields, context,
                                  RewriteFieldDefinition, current.WithFields);

            return(current);
        }
Exemplo n.º 5
0
 public virtual VisitorAction Leave(
     ObjectTypeDefinitionNode node,
     ISyntaxNode parent,
     IReadOnlyList <object> path,
     IReadOnlyList <ISyntaxNode> ancestors)
 {
     return(GetDefaultAction(node.Kind));
 }
Exemplo n.º 6
0
 protected override void VisitObjectTypeDefinition(
     ObjectTypeDefinitionNode node)
 {
     VisitName(node.Name);
     VisitIfNotNull(node.Description, VisitStringValue);
     VisitMany(node.Directives, VisitDirective);
     VisitMany(node.Interfaces, VisitNamedType);
     VisitMany(node.Fields, VisitFieldDefinition);
 }
Exemplo n.º 7
0
        public void DirectiveOrderIsSignificant()
        {
            // arrange
            var text   = "type Query { field: String @a @b @c }";
            var parser = new Parser();

            // assert
            DocumentNode document = parser.Parse(text);

            // assert
            ObjectTypeDefinitionNode type = document.Definitions
                                            .OfType <ObjectTypeDefinitionNode>().FirstOrDefault();

            Assert.Collection(type.Fields.Single().Directives,
                              t => Assert.Equal("a", t.Name.Value),
                              t => Assert.Equal("b", t.Name.Value),
                              t => Assert.Equal("c", t.Name.Value));
        }
Exemplo n.º 8
0
 protected virtual void VisitObjectTypeDefinition(
     ObjectTypeDefinitionNode node)
 {
 }
Exemplo n.º 9
0
 protected virtual void VisitObjectTypeDefinition(
     ObjectTypeDefinitionNode node,
     TContext context)
 {
 }