examples/

directory
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: MIT

README

Examples

Shape is the recommended entry point, so the examples start with complete struct Schemas. Run any entry from the module root:

go run ./examples/shape/explicit
Example Demonstrates
shape/explicit Explicit fields, composites, nested Schema, Apply, Refine, and ParseJSON
shape/types Standalone scalar/composite Schemas, every scalar factory, named numbers, time.Time, types.Duration, and Value[T]
shape/tags Cached Struct[T] and inferred tag binding
shape/json Reader input, strict JSON, byte limits, and atomic Bind
shape/errors Aggregate/fail-fast issues, paths, labels, and locale
shape/export JSON Schema Draft 2020-12 and OpenAPI 3.1 export

Independent building blocks

Example Demonstrates
validate Values, scalars, pointers, slices, maps, custom rules, composition, and fail-fast
transform The same type families, fallbacks, custom steps, and composition

Integration

Example Demonstrates
config Tagged defaults and human-readable duration strings
http Request cancellation, reader limits, and strict JSON

The independent examples intentionally run without importing the root package. The root shape package combines both capabilities in a reusable Schema[T] for scalars, composites, and structs.

Directories

Path Synopsis
shape
errors command
explicit command
export command
json command
tags command
types command

Jump to

Keyboard shortcuts

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