examples/

directory
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT

README

GoZod Examples

A curated set of examples to help you explore GoZod quickly without feeling overwhelmed. Navigate to any directory and run go run . to see it in action.

Folder Purpose
quickstart One-minute tour of basic validation—start here
primitive Core string / number validations & chaining
object Nested objects, optional fields, regex validation
coerce Primitive type coercion (string ⇄ number ⇄ bool ⇄ time)
intersection Combining schemas with logical AND constraints
union Flexible OR type example (string or int)
format Built-in format validators: Email, URL, ISO-8601, JWT
advanced_lazy Lazy / deferred schema construction demo
error_handling Structured error inspection & pretty printing
i18n Multilingual errors – switch to Simplified Chinese locale
config Real-world JSON config validation using MustParse
struct_tags Declarative struct tag validation with gozod:"required,min=2"
custom_tag Custom rule tag via WithTagName and yaml/toml field names via WithFieldNameTag
circular_references Automatic circular reference detection and handling
code_generation Zero-overhead code generation with go generate

Directories

Path Synopsis
Package main demonstrates explicit GoZod schema generation from struct tags.
Package main demonstrates explicit GoZod schema generation from struct tags.
Package main demonstrates GoZod struct tag validation usage This example covers the most important features in a simple, practical way.
Package main demonstrates GoZod struct tag validation usage This example covers the most important features in a simple, practical way.

Jump to

Keyboard shortcuts

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