config

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Overview

Package config ports config.ts's config discovery + loading: it finds a codegen config file (codegen.yml/codegen.json/package.json), parses it, and exposes a CodegenContext that carries the config plus CLI-flag overrides.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindConfig

func FindConfig(startDir string, moduleName string) string

FindConfig walks searchPlaces upward from startDir (or cwd) and returns the first matching config file's absolute path, or "" if none.

func Load

func Load(explicitPath string) (*plugin.Config, string, error)

Load finds and parses the config, honoring an explicit --config path (file or directory). Returns the parsed config, its filepath, and the directory it was resolved from (the context cwd).

func Validate

func Validate(cfg *plugin.Config) error

Validate ports the normalize() config validation in codegen.ts: it verifies the `generates` field exists, every output has plugins, and a schema is reachable (root-level or per-output).

Types

type Context

type Context struct {
	Config   *plugin.Config
	FilePath string
	Cwd      string
}

Context carries the resolved config + provenance and applies CLI-flag overrides. It mirrors the CodegenContext class in config.ts (minus the graphql-config project integration, deferred per D8).

func New

func New(cfg *plugin.Config, filepath string) *Context

New builds a Context. Like upstream, all relative schema/document/output paths resolve against the process working directory (or an explicit --cwd), NOT the config file's directory.

Jump to

Keyboard shortcuts

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