validation

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSchemaInvalid    = errors.New("schema invalid")
	ErrSchemaValidation = errors.New("schema validation failed")
	ErrSchemaMigration  = errors.New("schema migration invalid")
)

Functions

func NormalizeSchema

func NormalizeSchema(schema map[string]any) map[string]any

NormalizeSchema converts a schema definition into a JSON schema.

func ValidateMigrationPayload added in v0.23.0

func ValidateMigrationPayload(schema map[string]any, payload map[string]any) error

ValidateMigrationPayload validates migrated payloads against the target schema.

func ValidatePartialPayload

func ValidatePartialPayload(schema map[string]any, payload map[string]any) error

ValidatePartialPayload validates payload without enforcing required fields.

func ValidatePayload

func ValidatePayload(schema map[string]any, payload map[string]any) error

ValidatePayload validates payload against the provided schema.

func ValidateSchema

func ValidateSchema(schema map[string]any) error

ValidateSchema ensures the schema can be compiled.

Types

type PayloadValidationError added in v0.21.0

type PayloadValidationError struct {
	Issues []ValidationIssue
	Cause  error
}

PayloadValidationError surfaces validation issues with schema-aware context.

func (*PayloadValidationError) Error added in v0.21.0

func (e *PayloadValidationError) Error() string

func (*PayloadValidationError) Unwrap added in v0.21.0

func (e *PayloadValidationError) Unwrap() error

type ValidationIssue added in v0.21.0

type ValidationIssue struct {
	Location string
	Message  string
}

ValidationIssue captures a single validation failure.

func Issues added in v0.21.0

func Issues(err error) []ValidationIssue

Issues extracts validation issues from an error.

Jump to

Keyboard shortcuts

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