wellformed
Rust runtime, IR types, form helpers, and code generation utilities for wellformed schemas.
wellformed evaluates the same portable JSON intermediate representation (IR)
produced by the TypeScript builder package. Use it when schemas are authored in
TypeScript but enforcement needs to happen in a Rust service, worker, CLI, or
batch process.
Install
After the crate is published:
For local workspace development:
[]
= { = "../wellformed" }
= "1"
The crate declares Rust 1.82 as its minimum supported Rust version.
Validate JSON IR
use json;
use ;
use ;
Validation mutates the input serde_json::Value in place when transforms run.
Keep a copy of the raw input if your application needs both raw and normalized
values.
Custom Predicates
The default validate function uses the built-in predicate registry. Use
validate_with_registry when schemas contain organization-specific named
predicates. Custom predicates serialize by name and arguments only, so every
runtime that evaluates a schema must register equivalent implementations.
Form Facades
The companion wellformed-macros crate provides wellformed! for embedding a
schema as a value, form_schema! for a namespaced form facade with typed
values, field metadata, validation helpers, and framework-neutral form state,
and wel_schema! when you prefer free-floating generated Rust types.
Codegen Defaults
Rust codegen defaults to generated data types and validation helpers. API handlers, repository traits, OpenAPI constants, and PDF render handlers are explicit opt-ins because they require application-level dependencies and integration choices.
Optional Features
| Feature | Description |
|---|---|
address |
Enables libpostal-backed address parsing predicates through the postal crate. Requires native libpostal headers, libraries, and parser data. |
The default feature set does not require native address-parsing libraries.
Some libpostal installs, including Homebrew on Apple Silicon, expose headers
through pkg-config but not through Clang's default include path. In that case,
build with:
License
MIT.