Usage Examples

Welcome to the examples section for Adapters! These compilable walkthroughs showcase different core features and capabilities of the library:

1. Basic Schema Validation & Serialization

Demonstrates dynamic validation, struct mapping via simple tags, and round-trips from JSON using #[derive(Schema)].

2. Explicit Schema Builder

Learn how to define structural constraints dynamically at runtime without derive macros.

3. Advanced Validation Constraints

Explore full constraint capabilities like non-empty, alphanumeric, positive/negative bounds, and non-zero check rules.

4. Native JSON Parsing Engine

Showcases native, highly-optimized zero-dependency tokenization, unicode escapes, and pretty-print JSON formatting.

5. Deep Nested Object Models

Validate recursive children structures and gather accurate validation error paths (e.g., address.city).

6. Optional Fields & Default Values

Leverage Option fields and handle default fallback values programmatically.

7. Strict Type Coercion Mode

Prevent implicit casting or conversion of numeric and string types by opting into strict mode.

8. Data Transformation & Pipelines

Transform and adapt domain structures between database layouts and web responses.