validation

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package validation implements complete DraftView validation from Spec 007.

Index

Constants

View Source
const (
	SeverityInfo     = "info"
	SeverityWarning  = "warning"
	SeverityError    = "error"
	SeverityBlocking = "blocking"

	ReadinessReady   = "ready"
	ReadinessBlocked = "blocked"
	StatusFresh      = "fresh"
	StatusStale      = "stale"
)

Variables

View Source
var ErrNotFound = errors.New("validation result not found")

Functions

func ExitCodeFor

func ExitCodeFor(diagnostics []Diagnostic) int

ExitCodeFor returns the CLI process exit code defined by Spec 007.

func ReadinessFor

func ReadinessFor(diagnostics []Diagnostic) string

ReadinessFor returns the complete-validation readiness for diagnostics.

func SortDiagnostics

func SortDiagnostics(diagnostics []Diagnostic)

SortDiagnostics applies the frozen diagnostic ordering.

Types

type Diagnostic

type Diagnostic struct {
	Code             string `json:"code"`
	Path             string `json:"path"`
	Severity         string `json:"severity"`
	Message          string `json:"message"`
	EntityRef        string `json:"entity_ref,omitempty"`
	FixSuggestion    string `json:"fix_suggestion"`
	DocumentationURL string `json:"documentation_url,omitempty"`
}

Diagnostic is the stable, display-independent diagnosis contract.

func Validate

func Validate(input Input) []Diagnostic

Validate dispatches to the validator for the selected mobile advertising Pack version. Other Pack versions have no domain rules yet.

type Input

type Input struct {
	PackRef           string
	EnvironmentID     string
	EnvironmentKind   string
	Effective         map[string]any
	RestrictedDeletes []RestrictedDelete
}

Input is the captured DraftView data needed for a complete validation run. RestrictedDeletes is supplied by callers that validate a pending restricted deletion; ordinary full validation leaves it empty.

type RestrictedDelete

type RestrictedDelete struct {
	EntityType string
	EntityID   string
}

type Result

type Result struct {
	EnvironmentID          string       `json:"environment_id"`
	ValidatedDraftRevision uint64       `json:"validated_draft_revision"`
	ValidatedAt            time.Time    `json:"validated_at"`
	Status                 string       `json:"status"`
	Readiness              string       `json:"readiness"`
	Diagnostics            []Diagnostic `json:"diagnostics"`
}

Result is persisted after a complete validation run.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store persists complete-validation results next to draft state. This is a temporary Spec 005 boundary: source configuration persistence is not owned by this file and validation records remain local under .conflow.

func NewMemory

func NewMemory() *Store

func Open

func Open(path string) (*Store, error)

func (*Store) Get

func (s *Store) Get(environmentID string, currentDraftRevision uint64) (Result, error)

func (*Store) Save

func (s *Store) Save(result Result) error

Jump to

Keyboard shortcuts

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