validator

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package validator provides validation for command structs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Issue

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

Issue represents a validation problem found in a command.

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{}

Validator validates command structs.

func New

func New() *Validator

New creates a new Validator.

func (*Validator) Validate

func (v *Validator) Validate(cmd parser.Commandable, path string) *Result

Validate checks a command for compliance. The path parameter is used for name inference if the command has no name. 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