validate

command
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package main shows how to use Codec.Validate and Format.Validate for explicit bidirectional validation.

By design, go-codex only validates in the decode direction — constraints guard external input (JSON, YAML, TOML) that you don't control. The encode direction is trusted: you constructed the value yourself.

When you need to validate a Go value you constructed (e.g. before storing it, or after building it programmatically), call Validate explicitly. It reuses the exact same Refine constraints — no duplication needed.

Jump to

Keyboard shortcuts

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