Documentation
¶
Overview ¶
Package validator provides a unified validation framework for aix components.
It defines shared types for representing validation issues (errors, warnings, info) and results across different domains like Skills, MCP servers, and Agents.
Core Concepts ¶
- Severity: Distinguishes between blocking errors and non-blocking warnings.
- Issue: Represents a single validation problem with field context.
- Result: Aggregates multiple issues and provides helper methods.
Basic Usage ¶
result := &validator.Result{}
if name == "" {
result.AddError("name", "is required", name)
}
if result.HasErrors() {
// handle validation failure
}
Package validator provides a unified validation framework for aix.
Index ¶
- type Format
- type Issue
- type Reporter
- type Result
- func (r *Result) AddError(field, message string, value any)
- func (r *Result) AddInfo(field, message string, value any)
- func (r *Result) AddWarning(field, message string, value any)
- func (r *Result) Errors() []Issue
- func (r *Result) HasErrors() bool
- func (r *Result) HasWarnings() bool
- func (r *Result) Warnings() []Issue
- type Severity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Issue ¶
type Issue struct {
// Severity indicates the impact of the issue.
Severity Severity
// Field identifies the field with the issue (optional).
Field string
// Message is a human-readable description of the problem.
Message string
// Value is the actual value that failed validation (optional).
Value any
// Context is additional platform-specific or domain-specific context.
Context map[string]string
}
Issue represents a single validation problem.
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter formats and writes validation results.
func NewReporter ¶
NewReporter creates a new Reporter.
type Result ¶
type Result struct {
Issues []Issue
}
Result aggregates validation issues.
func (*Result) AddWarning ¶
AddWarning adds a warning issue to the result.
func (*Result) HasWarnings ¶
HasWarnings returns true if any issue has SeverityWarning.
Click to show internal directories.
Click to hide internal directories.