validation

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package validation provides validation utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() ports.Validator

New returns the default validator implementation.

func NewBasicValidator

func NewBasicValidator() ports.Validator

NewBasicValidator retains the old constructor name but now returns the go-playground-backed validator.

func NewPlaygroundValidator

func NewPlaygroundValidator() ports.Validator

NewPlaygroundValidator constructs a validator backed by github.com/go-playground/validator/v10.

Types

type ValidationError

type ValidationError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
	Value   string `json:"value,omitempty"`
}

ValidationError represents a validation error with field-specific details.

func (ValidationError) Error

func (e ValidationError) Error() string

func (ValidationError) FieldErrors

func (e ValidationError) FieldErrors() fielderrors.FieldErrors

FieldErrors converts the validation error to standard field errors.

type ValidationErrors

type ValidationErrors struct {
	Errors []ValidationError `json:"errors"`
}

ValidationErrors represents multiple validation errors.

func (ValidationErrors) Error

func (e ValidationErrors) Error() string

func (ValidationErrors) FieldErrors

func (e ValidationErrors) FieldErrors() fielderrors.FieldErrors

FieldErrors converts the validation errors to standard field errors.

Jump to

Keyboard shortcuts

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