# README
GraphQL Compiler Internals
Package compiler
provides types and interfaces for interacting with or implementing
a compiler for the GraphQL IDL.
Features
- Import Tree Reduction
- Type Validation
- Type Merging
Import Tree Reduction
GraphQL documents can import one another with the following directive:
directive @import(paths: [String]!) on DOCUMENT
Type Validation
Type Validation/Checking is provided by implementing the TypeChecker
interface. The
Validate
function is a TypeChecker
that enforces type validation, per the GraphQL spec.
Type Merging
Type merging handles merging type extensions with their original type definition.
# Packages
Package spec provides the types and validator as defined by the GraphQL spec.
# Functions
CheckTypes is a helper function for running a suite of type checking on several GraphQL Documents.
FromIR converts the compiler intermediate representation back to a simple slice of GraphQL Documents.
Lookup returns the Type and the Document it belongs to, or nil.
MergeExtensions merges type extensions with their original declaration.
ReduceImports reduces a set of Documents by including imported type defs into the Documents that they're imported into.
RegisterTypes registers pre-defined types with the compiler.
TestTypeChecker implements a few tests for custom type checkers.
ToIR converts a GraphQL Document to a intermediate representation for the compiler internals.
# Variables
ImportValidator validates that all types are correctly imported.
Types contains the builtin types provided by the compiler and any custom types given to RegisterTypes.
# Structs
ImportError represents an error with the imports in a GraphQL Document.
TypeError represents a type error.
# Interfaces
TypeChecker represents type checking functionality for a GraphQL Document.
# Type aliases
IR is a representation used by the compiler APIs.
TypeCheckerFn represents a single function behaving as a TypeChecker.