typebox-rs
JSON Schema type construction with validation, code generation, and binary layout. Inspired by TypeBox.
Documentation | Crate | Repository
Example
use ;
// Define a schema
let person = object
.field
.field
.optional_field
.named;
// Create a default value
let value = create?;
assert!;
// Work with values
let a = object
.field
.field
.build;
let b = object
.field
.field
.build;
// Compute and apply diffs
let edits = delta;
let restored = patch?;
assert_eq!;
Usage
[]
= "0.1"
Feature Flags
| Flag | Description |
|---|---|
codegen |
Generate Rust/TypeScript code from schemas |
fake |
Generate random test data (fake + rand crates) |
pattern |
Regex pattern validation for strings |
safetensor |
SafeTensor file reading support |
ffi |
C-compatible FFI types |
Default: none (minimal by default)
License
MIT