Documentation
¶
Overview ¶
Package diagnostics defines the Diagnostic type, severity levels, and the deterministic sort/format rules used to report configuration and generation problems across every validation stage of the pipeline.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
func Format(d Diagnostic) string
Format renders a single Diagnostic in the textual shape documented by contracts/diagnostics-contract.md's example:
error: contexts.content.models.User.operations.insert query CreateUser uses :exec, but the default insert lifecycle requires :one so the persisted row can hydrate generated fields. Hint: add RETURNING ... and change the annotation to :one, or select an explicit non-hydrating insert policy when that policy becomes supported.
func FormatAll ¶
func FormatAll(diags []Diagnostic) string
FormatAll renders a sorted diagnostic list as the plugin's full textual error output, one diagnostic per paragraph.
func HasError ¶
func HasError(diags []Diagnostic) bool
HasError reports whether diags contains at least one SeverityError diagnostic. Any single error means zero files are emitted for the run (FR-017) — this is the atomicity check used by internal/plan and the top-level generation pipeline.
Types ¶
type Diagnostic ¶
type Diagnostic struct {
Severity Severity
Path string
Context string
Model string
Relation string
Query string
Message string
Hint string
}
Diagnostic reports a single problem found by any validation stage in the pipeline. See contracts/diagnostics-contract.md for the authoritative shape and failure semantics.
func Sort ¶
func Sort(diags []Diagnostic) []Diagnostic
Sort orders diagnostics deterministically by (Path, Context, Model, Query) ascending, per contracts/diagnostics-contract.md's Ordering section. It sorts in place and also returns the slice for convenience.