Language

Abstract Syntax Tree (AST)

Hot Chocolate seems to focus solely around ObjectType, InputType et al. These types work as an interface to configure the GraphQL schema. This schema is used to parse and validate incoming requests. Under the hood, every query, mutation or subscription request is parsed into a so-called abstract syntax tree. Each node of this tree denotes a part of the incoming GraphQL query.

query Users {
  userName
  address {
    street
    nr
  }
}
OperationDefinitionNode
SelectionSetNode
FieldNode (userName)
FieldNode (address)
SelectionSetNode
FieldNode (street)
FieldNode (nr)

Syntax Node

Every node in a syntax tree implements ISyntaxNode.

ūüí° The ToString method of a syntax node prints the corresponding GraphQL syntax.

This interface defines the NodeKind of the node.

Node Kinds:

Name Description (Spec Link) Context Example
Name All names. e.g. Field, Argument ... Both foo
NamedType Denotes a reference to a type Both Foo
ListType Definition of a list Both [Foo]
NonNullType Definition of type that cannot be null Both Foo!
Argument Representation of an argument. Has a Name and a Value Both foo: "bar"
Directive Denotes a directive Query @foo
Document Describes a complete file or request a GraphQL service operates on. Query (out)
OperationDefinition Describes a graphql operation like query mutation or subscription Query (out) query Foo {}
VariableDefinition The variables defined by an operation Query (out) ($foo: String)
Variable A variable Query (out) $foo
SelectionSet specifies a selection of Field, FragmentSpread or InlineFragment Query (out) {foo bar}
Field Describes a field as a part of a selection set Query (out) foo
FragmentSpread Denotes a spread of a FragemntDefinition Query (out) ...f1
InlineFragment Denotes an inline fragment Query (out) ... on Foo { bar}
FragmentDefinition Defines the definition of a fragment Query (out) fragment f1 on Foo {}
IntValue Denotes a int value Query (in) 1
StringValue Denotes a string value Query (in) "bar"
BooleanValue Denotes a boolean value Query (in) true
NullValue Denotes a null value Query (in) null
EnumValue Denotes a enum value Query (in) FOO
FloatValue Denotes a Float value Query (in) 0.2
ListValue Denotes a List value Query (in) ["string"]
ObjectValue Denotes a ObjectValue value Query (in) {foo: "bar" }
ObjectField Denotes a field of am input object type Query (in) foo: "bar"
SchemaDefinition Definition of a schema Schema schmea {}
OperationTypeDefinition This defines one of the root operations Query, Mutation or Subscription on the schema-definiton Schema query:FooQuery
ScalarTypeDefinition Definition of a scalar Schema scalar JSON
ObjectTypeDefinition Definition of an object type Schema type Foo{}
FieldDefinition Definition of a field Schema bar:String
InputValueDefinition Definition of a input value of an argument Schema x: Float
InterfaceTypeDefinition Definition of an interface Schema interface NamedEntity {}
UnionTypeDefinition Definition of an union Schema union Ex = Foo | Bar
EnumTypeDefinition Definition of an enum Schema enum Foo {BAR}
EnumValueDefinition Definition of an enum value Schema BAR
InputObjectTypeDefinition Definition of an input type definition Schema input FooInput {}
SchemaExtension Definition of a schema extension Schema extend schema {}
ScalarTypeExtension Definition of a scalar extension Schema extend scalar Foo @bar
ObjectTypeExtension Definition of an object type extension Schema extend type Foo { name}
InterfaceTypeExtension Definition of an interface type extension Schema extend interface NamedEntity {}
UnionTypeExtension Definition of an union type extension Schema extend union Ex = Foo{}
EnumTypeExtension Definition of an enum type extension Schema extend enum foo{}
InputObjectTypeExtension Definition of an input types Schema input foo {}
DirectiveDefinition Definition of a directive Schema directive @foo on