Discover Packages
github.com/rhevorn/shape
examples
directory
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Apr 6, 2025
License: MIT
Opens a new window with license information.
README
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
Recommended: shape
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.
Expand ▾
Collapse ▴
Directories
¶
shape
Click to show internal directories.
Click to hide internal directories.