Documentation
¶
Overview ¶
Package output writes *validate.ValidationResult values in text, JSON or YAML form. It is intentionally separate from the parent validate package so that programmatic consumers can depend on validation data without pulling in YAML/JSON encoding dependencies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Format ¶
type Format string
Format names a Renderer. It is a defined string type rather than a bare string so that call sites can use the symbolic constants below (FormatText, FormatJSON, FormatYAML) instead of embedding raw "text"/"json"/"yaml" literals, and so the compiler catches accidental cross-wiring of unrelated string flags.
type Options ¶
type Options struct {
// SkipSuccessResults suppresses per-resource success lines in text output.
// It has no effect on JSON or YAML output, where success entries are
// always part of the structured payload.
SkipSuccessResults bool
}
Options configures how a validation result is rendered.
type Renderer ¶
type Renderer interface {
Render(result *pkgvalidate.ValidationResult, w io.Writer, opts Options) error
}
Renderer writes a *ValidationResult to an io.Writer in some specific encoding. Implementations are obtained via RendererFor; the package exposes no other constructors so the supported set is fully closed.
func RendererFor ¶
RendererFor returns the Renderer for the given format. The empty string is accepted as FormatText for ergonomics with zero-valued config; any other unrecognised value returns an error. This is the one and only boundary between a format identifier and the typed Renderer dependency that downstream code receives.