Documentation
¶
Overview ¶
Package yamlconf loads YAML configuration and keeps track of where every key came from.
Both of rig's configuration formats — the project file and the per-table files — are validated against a JSON Schema generated from their Go structs, and both report problems at the exact line and column of the offending key. That machinery lives here so the two cannot drift apart in how strictly they read a file or how precisely they report a mistake.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Format ¶
type Format struct {
// ID is the schema's $id, for example "https://rig.dev/schema/table.v1.json".
ID string
// Title and Description document the format in the emitted schema.
Title string
Description string
// New returns a fresh zero value of the format's root struct. It is called
// both to reflect the schema and to decode into.
New func() any
// contains filtered or unexported fields
}
Format describes one configuration file format: the Go struct that defines it, and the identity its JSON Schema publishes itself under.
The schema is generated once and reused for two purposes — written to disk for editors, and compiled as the validator. One schema, so what an editor accepts and what rig accepts cannot diverge.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index maps a dotted path within a configuration file to the position of the key that declares it.
Paths use the shape "columns.title.comment" for mappings and "endpoints.0.name" for sequences, which is also how schema violations report their location, so the two line up without translation.
func BuildIndex ¶
BuildIndex walks a parsed document and records where every key sits.
func (*Index) At ¶
At returns the anchor for a path.
When the exact path is not in the file — a missing required key, say — the lookup walks up to the nearest ancestor that is. Pointing at the enclosing key is far more useful than pointing at line 1, and it is what a reader expects: the problem is *in* that block.