Documentation
¶
Overview ¶
Package config loads and validates a driftsync.yaml file — the per-project description of how to obtain the code-side spec and what to compare it against. It is the single source of truth for the `check`, `sync`, and `init` commands.
Index ¶
Constants ¶
const DefaultPath = "driftsync.yaml"
DefaultPath is where driftsync looks for the config when none is given.
Variables ¶
var Stacks = []string{"fastapi", "nestjs", "spring", "huma", "swaggo", "generic"}
Stacks are the recognized `driftsync init --stack` values.
Functions ¶
func ConfigTemplate ¶
ConfigTemplate returns the starter driftsync.yaml for a stack.
func ExampleConfigs ¶
func ExampleConfigs() []string
ExampleConfigs lists the embedded per-stack configs, for docs/tests.
func GenspecTemplate ¶
GenspecTemplate returns the tools/genspec/main.go starter for in-process (huma) extraction. Only meaningful for --stack huma.
func WorkflowTemplate ¶
WorkflowTemplate returns a GitHub Actions workflow: "check" or "sync".
Types ¶
type Code ¶
type Code struct {
// Command is a shell snippet that writes the code-side spec to File.
// Optional: omit it when File is already generated/committed. Chain any
// conversion here too (e.g. swaggo's 2.0 -> 3.x step).
Command string `yaml:"command"`
// File is the path the code-side spec is read from after Command runs
// (or a pre-existing file when Command is empty).
File string `yaml:"file"`
}
Code describes how to get the OpenAPI spec your code actually produces.
type Config ¶
type Config struct {
Version int `yaml:"version"`
// Published is the spec you maintain — the contract consumers see.
Published string `yaml:"published"`
Code Code `yaml:"code"`
FailOn FailOn `yaml:"fail_on"`
Enrich Enrich `yaml:"enrich"`
Report Format `yaml:"report"`
ReportFile string `yaml:"report_file"`
// SyncOutput is where `sync` writes the corrected spec. Empty = overwrite
// Published in place.
SyncOutput string `yaml:"sync_output"`
// BaseDir is the directory the config lives in; every relative path above
// is resolved against it and Command runs with it as the working directory.
// Not a YAML field.
BaseDir string `yaml:"-"`
// Source is the path the config was loaded from, for error messages.
Source string `yaml:"-"`
}
Config is a parsed, validated, path-resolved driftsync.yaml.
type Enrich ¶
type Enrich string
Enrich controls the optional LLM description step in `driftsync sync`.