prepack

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTestFile added in v0.0.9

func IsTestFile(name string, ext string) bool

IsTestFile returns true if the filename follows the *_test.<ext> convention.

Types

type FileError

type FileError struct {
	File  string
	Error string
}

FileError associates a validation error with the file that caused it.

type ValidationOptions

type ValidationOptions struct {
	SkipTests bool
}

ValidationOptions controls which stages run in the pre-pack pipeline.

type ValidationResult

type ValidationResult struct {
	FilesChecked       int
	MissingFiles       []string
	SyntaxErrors       []FileError
	ContractViolations []evaluator.ContractViolation
	TestResults        *evaluator.TestResults
	TestsSkipped       bool
}

ValidationResult holds the outcome of the pre-pack validation pipeline.

func Validate

func Validate(ctx context.Context, contentDir string, eval evaluator.Evaluator, cueSchemas []cue.Value, opts ValidationOptions) (*ValidationResult, error)

Validate runs the pre-pack validation pipeline against a content directory. Four stages execute in order, each fail-fast:

  1. Required files -- verify evaluator-specific companion files exist
  2. Syntax check -- parse non-test policy files individually
  3. Contract check -- verify input.* references against CUE schema
  4. Test execution -- run policy unit tests

If cueSchemas is empty, contract checking is skipped with a warning.

func (*ValidationResult) Valid

func (r *ValidationResult) Valid() bool

Valid returns true if there are no syntax errors, contract violations, or test failures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL