Hot Chocolatev13
This is documentation for v13, which is no longer actively maintained.
For up-to-date documentation, see the latest stable version.

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.

GraphQL
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:

NameDescription (Spec Link)ContextExample
NameAll names. e.g. Field, Argument ...Bothfoo
NamedTypeDenotes a reference to a typeBothFoo
ListTypeDefinition of a listBoth[Foo]
NonNullTypeDefinition of type that cannot be nullBothFoo!
ArgumentRepresentation of an argument. Has a Name and a ValueBothfoo: "bar"
DirectiveDenotes a directiveQuery@foo
DocumentDescribes a complete file or request a GraphQL service operates on.Query (out)
OperationDefinitionDescribes a graphql operation like query mutation or subscriptionQuery (out)query Foo {}
VariableDefinitionThe variables defined by an operationQuery (out)(\$foo: String)
VariableA variableQuery (out)\$foo
SelectionSetspecifies a selection of Field, FragmentSpread or InlineFragmentQuery (out){foo bar}
FieldDescribes a field as a part of a selection setQuery (out)foo
FragmentSpreadDenotes a spread of a FragmentDefinitionQuery (out)...f1
InlineFragmentDenotes an inline fragmentQuery (out)... on Foo { bar}
FragmentDefinitionDefines the definition of a fragmentQuery (out)fragment f1 on Foo {}
IntValueDenotes a int valueQuery (in)1
StringValueDenotes a string valueQuery (in)"bar"
BooleanValueDenotes a boolean valueQuery (in)true
NullValueDenotes a null valueQuery (in)null
EnumValueDenotes a enum valueQuery (in)FOO
FloatValueDenotes a Float valueQuery (in)0.2
ListValueDenotes a List valueQuery (in)["string"]
ObjectValueDenotes a ObjectValue valueQuery (in){foo: "bar" }
ObjectFieldDenotes a field of am input object typeQuery (in)foo: "bar"
SchemaDefinitionDefinition of a schemaSchemaschema {}
OperationTypeDefinitionThis defines one of the root operations Query, Mutation or Subscription on the schema-definitionSchemaquery:FooQuery
ScalarTypeDefinitionDefinition of a scalarSchemascalar JSON
ObjectTypeDefinitionDefinition of an object typeSchematype Foo{}
FieldDefinitionDefinition of a fieldSchemabar:String
InputValueDefinitionDefinition of a input value of an argumentSchemax: Float
InterfaceTypeDefinitionDefinition of an interfaceSchemainterface NamedEntity {}
UnionTypeDefinitionDefinition of an unionSchemaunion Ex = Foo | Bar
EnumTypeDefinitionDefinition of an enumSchemaenum Foo {BAR}
EnumValueDefinitionDefinition of an enum valueSchemaBAR
InputObjectTypeDefinitionDefinition of an input type definitionSchemainput FooInput {}
SchemaExtensionDefinition of a schema extensionSchemaextend schema {}
ScalarTypeExtensionDefinition of a scalar extensionSchemaextend scalar Foo @bar
ObjectTypeExtensionDefinition of an object type extensionSchemaextend type Foo { name}
InterfaceTypeExtensionDefinition of an interface type extensionSchemaextend interface NamedEntity {}
UnionTypeExtensionDefinition of an union type extensionSchemaextend union Ex = Foo{}
EnumTypeExtensionDefinition of an enum type extensionSchemaextend enum foo{}
InputObjectTypeExtensionDefinition of an input typesSchemainput foo {}
DirectiveDefinitionDefinition of a directiveSchemadirective @foo on