formats

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: 7 Imported by: 0

Documentation

Overview

Package formats demonstrates the builtin format constraints in validate/, as well as WithExample, WithDeprecated, and the Duration codec.

Each constraint validates a common string format (email, UUID, URL, etc.) and also annotates the codec's schema so the format appears in OpenAPI output automatically — no extra work needed.

WithExample adds a sample value to the generated schema for documentation. WithDeprecated marks a field as deprecated in the generated schema. Duration encodes time.Duration as a human-readable string ("1h30m5s").

Run with: go run ./examples/formats

Jump to

Keyboard shortcuts

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