load

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package load ports load.ts: schema and document loading from file pointers and globs, backed by gqlparser. URL and introspection-JSON loaders are deferred per plan decision D9.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandPointers

func ExpandPointers(pointers []any, cwd string) ([]string, error)

ExpandPointers normalises a pointer (string | map[string]any | []any) into a flat list of concrete file paths by expanding globs. Map keys are treated as pointers, values (options) are ignored for now.

func LoadDocuments

func LoadDocuments(files []string) ([]*plugin.DocumentFile, error)

LoadDocuments reads + parses GraphQL operation documents from files, returning one DocumentFile per file. .graphql/.gql files are parsed directly; code files (.ts/.tsx/.js) have gql-tagged templates plucked (basic support).

func LoadSchema

func LoadSchema(files []string) (*ast.Schema, error)

LoadSchema reads + merges all schema files into a resolved *ast.Schema (the graphql-js buildASTSchema equivalent). It prepends validator.Prelude. Mirroring @graphql-tools/load's default sort:true, it sorts type fields and enum values alphabetically after loading.

func NormalizeDocumentPointers

func NormalizeDocumentPointers(docs any, cwd string) ([]*plugin.DocumentFile, error)

NormalizeDocumentPointers converts the config's documents field into a []*DocumentFile.

func WalkDocuments

func WalkDocuments(schema *ast.Schema, docs []*plugin.DocumentFile) error

WalkDocuments populates the type back-references on document nodes (field.Definition, field.ObjectDefinition, inlineFragment.ObjectDefinition, fragmentSpread.Definition) so plugins can resolve selection-set field types. It mirrors graphql-js's visitWithTypeInfo.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL