Documentation
¶
Overview ¶
Package validate provides the domain orchestration behind the 'validate' command group. It is a leaf package: it depends on pkg/lint and the solution loader, but nothing in those packages depends on it, avoiding an import cycle (pkg/lint already imports pkg/schema, so this helper cannot live in pkg/schema).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SolutionResult ¶
type SolutionResult struct {
// File is the resolved solution file path that was validated.
File string
// Lint is the lint result produced by lint.Solution.
Lint *lint.Result
}
SolutionResult captures the outcome of validating a solution. It bundles the resolved file path with the lint result so callers can render findings and decide pass/fail via Passed.
func LoadedSolution ¶
func LoadedSolution(sol *solution.Solution, filePath string, registry *provider.Registry) *SolutionResult
LoadedSolution runs lint against an already-loaded solution. It is the pure orchestration seam used by Solution and is convenient for tests that construct a solution in memory.
func Solution ¶
func Solution(ctx context.Context, filePath string, registry *provider.Registry) (*SolutionResult, error)
Solution loads a solution and runs lint against it, returning a SolutionResult. It reuses the same resolution chain as the lint command (explicit file > positional arg > auto-discovery) so behavior matches 'scafctl lint'. Schema conformance is checked by lint.Solution itself, so callers must NOT additionally invoke the standalone schema validator.
The registry is used for provider-aware lint rules; when nil, lint falls back to a default registry.
func (*SolutionResult) Passed ¶
func (r *SolutionResult) Passed(strict bool) bool
Passed reports whether validation passed. A solution passes when it has no lint errors. When strict is true, warnings are also treated as fatal, so any warning causes Passed to return false.