Help us shape the future of Go! Take the 2026 Go Developer Survey

validate

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptanceMissing added in v0.7.0

func AcceptanceMissing(rec *model.AcceptanceRecord) []string

AcceptanceMissing returns the parts an acceptance record lacks: actor, date, and statement or decisionRef. It is empty for a complete record. TRLC-LINKS: REQ-EMG-085 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

func ControlNeedsReview added in v0.7.0

func ControlNeedsReview(statuses []string) bool

ControlNeedsReview reports whether the Gemara evaluation log gives a control with these verification statuses the result Needs Review: it has no verification, or at least one needs review and none failed or is unknown (Failed and Unknown outrank Needs Review in the log's aggregate). TRLC-LINKS: REQ-EMG-083 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

func HasErrors

func HasErrors(diags []Diagnostic) bool

ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, STATE-MODEL-VALID, STATE-MODEL-INVALID, EVT-VALIDATION-FAILED TRLC-LINKS: REQ-EMG-001, REQ-EMG-009, REQ-EMG-011

Types

type AcceptanceProblem added in v0.7.0

type AcceptanceProblem struct {
	Field   string // actor, date or decisionRef
	Message string
}

AcceptanceProblem is one acceptedBy field that does not resolve. ENGMODEL-LINKS: FU-VALIDATION-ENGINE

type AcceptanceRefs added in v0.7.0

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

AcceptanceRefs resolves the references of acceptance records against one model: its actors and its decisions with their status. Validation and the Gemara policy share it, so a record the policy lists as accepted is one validation accepts. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

func NewAcceptanceRefs added in v0.7.0

func NewAcceptanceRefs(b model.Bundle) AcceptanceRefs

NewAcceptanceRefs collects the actors and decisions of a bundle. TRLC-LINKS: REQ-EMG-085 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

func (AcceptanceRefs) Problems added in v0.7.0

Problems returns the fields of a record that are set but do not resolve: an actor that is no actor, a date that is no calendar date in YYYY-MM-DD, and a decisionRef that is no decision or a decision whose status is not accepted. TRLC-LINKS: REQ-EMG-085 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

func (AcceptanceRefs) Resolves added in v0.7.0

func (r AcceptanceRefs) Resolves(rec *model.AcceptanceRecord) bool

Resolves reports whether a record is complete and every field resolves: the condition for listing a risk as accepted. TRLC-LINKS: REQ-EMG-085 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

type Diagnostic

type Diagnostic struct {
	Code     string   `json:"code"`
	Severity Severity `json:"severity"`
	Message  string   `json:"message"`
	Path     string   `json:"path,omitempty"`
}

ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, STATE-MODEL-VALID, STATE-MODEL-INVALID, EVT-VALIDATION-FAILED

func Bundle

func Bundle(b model.Bundle) []Diagnostic

ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, STATE-MODEL-VALID, STATE-MODEL-INVALID, EVT-VALIDATION-FAILED, FU-VIEW-PROJECTION TRLC-LINKS: REQ-EMG-001, REQ-EMG-009, REQ-EMG-011, REQ-EMG-035, REQ-EMG-036, REQ-EMG-037, REQ-EMG-041, REQ-EMG-043, REQ-EMG-049, REQ-EMG-065, REQ-EMG-070, REQ-EMG-082, REQ-EMG-083, REQ-EMG-085

func DedupeDiagnostics

func DedupeDiagnostics(lists ...[]Diagnostic) []Diagnostic

DedupeDiagnostics merges diagnostic lists produced by separate checks of one run (for example document generation and the trace check, which both run the trace-integrity check) so each finding is reported once. Diagnostics are identified by code, path and message; the first occurrence keeps its position, and an error severity on any duplicate wins over a warning. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, EVT-VALIDATION-FAILED TRLC-LINKS: REQ-EMG-001, REQ-EMG-009, REQ-EMG-011

func SortDiagnostics

func SortDiagnostics(in []Diagnostic) []Diagnostic

ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, STATE-MODEL-VALID, STATE-MODEL-INVALID, EVT-VALIDATION-FAILED TRLC-LINKS: REQ-EMG-001, REQ-EMG-009, REQ-EMG-011, REQ-EMG-012

type RelationshipPair

type RelationshipPair struct {
	Type string `json:"type"`
	From string `json:"from"`
	To   string `json:"to"`
}

RelationshipPair is one allowed authoredArchitecture.mappings type with the entity kinds of its from and to ends. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, DO-MODEL-AUTHORING-CONTRACT

type Rules

type Rules struct {
	Enums             map[string][]string `json:"enums"`
	RelationshipPairs []RelationshipPair  `json:"relationshipPairs"`
	FieldRules        []string            `json:"fieldRules"`
	// FieldSets lists, per entity kind, the YAML fields strict decoding
	// accepts, in declaration order; any other field is rejected.
	FieldSets map[string][]string `json:"fieldSets"`
	// PublicationSections are the manifest publication sections that may
	// export stable IDs. Decisions cannot be published.
	PublicationSections []string `json:"publicationSections"`
}

Rules is the machine-readable subset of the validation rules that agents need before authoring YAML: controlled vocabularies, allowed relationship kind pairs and cross-reference field rules. It is derived from the same tables Bundle uses, so it cannot drift from validation. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, DO-MODEL-AUTHORING-CONTRACT

func AuthoringRules

func AuthoringRules() Rules

AuthoringRules returns the validation vocabularies and relationship pairs as sorted, deterministic data for the model authoring contract. TRLC-LINKS: REQ-EMG-045, REQ-EMG-009, REQ-EMG-082, REQ-EMG-083, REQ-EMG-085, REQ-EMG-087 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, DO-MODEL-AUTHORING-CONTRACT

type Severity

type Severity string

ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, STATE-MODEL-VALID, STATE-MODEL-INVALID, EVT-VALIDATION-FAILED

const (
	SeverityError   Severity = "error"
	SeverityWarning Severity = "warning"
)

type VerificationOutcome added in v0.7.0

type VerificationOutcome int

VerificationOutcome is the evaluation result a control verification status stands for. The Gemara evaluation log maps it to its Result values. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

const (
	OutcomeNotRun VerificationOutcome = iota
	OutcomePassed
	OutcomeFailed
	OutcomeNeedsReview
	OutcomeNotApplicable
	OutcomeUnknown
)

Verification outcomes.

func ClassifyVerificationStatus added in v0.7.0

func ClassifyVerificationStatus(status string) VerificationOutcome

ClassifyVerificationStatus maps a control verification status (trimmed, any case) to its outcome; an unrecognized status is OutcomeUnknown. TRLC-LINKS: REQ-EMG-083, REQ-EMG-015 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

Jump to

Keyboard shortcuts

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