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
Click to show internal directories.
Click to hide internal directories.