validator

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package validator provides validation for agent structs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agentable

type Agentable interface {
	GetName() string
	GetDescription() string
	GetInstructions() string
}

Agentable is implemented by agent types that can be validated.

type Issue

type Issue struct {
	Level   Level
	Field   string
	Message string
	Value   string
}

Issue represents a validation problem found in an agent.

func (*Issue) Error

func (i *Issue) Error() string

type Level

type Level int

Level represents the severity of a validation issue.

const (
	// Warning indicates a recommended but non-blocking issue.
	Warning Level = iota
	// Error indicates a blocking validation failure.
	Error
)

type Result

type Result struct {
	Errors   []Issue
	Warnings []Issue
}

Result contains the validation results.

func (*Result) HasErrors

func (r *Result) HasErrors() bool

HasErrors returns true if there are any validation errors.

type Validator

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

Validator validates agent structs.

func New

func New(strict bool) *Validator

New creates a new Validator. When strict is true, additional warnings are generated for missing optional fields.

func (*Validator) Validate

func (v *Validator) Validate(agent Agentable, path string) *Result

Validate checks an agent for compliance. The path parameter is used for context in error messages. Returns a Result containing errors and warnings.

Jump to

Keyboard shortcuts

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