wp-model-core
Overview
wp-model-core is the typed data model that powers the Warp PASE stack. It defines the field, record, and value abstractions that upstream services rely on to validate input, serialize payloads, and reason about metadata in a consistent way. The crate ships as a library only and leans on familiar Rust tooling (serde, chrono, ipnet, smol_str) for ergonomics.
Features
- 20+ value variants (
Value::Bool,Value::Email,Value::IpNet, etc.) backed by lightweightsmol_strstorage for short text fields. - Rich metadata through
DataType, ensuring every value carries run-time constraints (format, semantic type, array hints). - Field and record containers with ergonomic builders (
Field::from_digit,Record::set_id) plus shared aliases (DataField,DataRecord). - Serde integration and deterministic formatting helpers (
LevelFormatAble) for debugging or downstream logging. thiserrorbased error types that keep callers away fromunwrap/expectpaths.
Project Layout
src/lib.rsexposesmodelandtraitsmodules.src/model/hosts the value system, field/record implementations, formatting helpers, macros, and theREADME.mdthat documents the design.src/traits.rsprovides shared traits such asAsValueRefconsumed across models.docs/holds supplementary specs;AGENTS.mddocuments contributor expectations.
Quick Start
# Cargo.toml
= "0.7"
use ;
let mut record = default;
record.append;
record.append;
assert_eq!;
Development Workflow
Run cargo check for quick iteration, cargo build for release targets, and cargo test to execute the co-located unit suites (see src/model/data/*). Format with cargo fmt --all, lint with cargo clippy --all-targets --all-features -D warnings, and regenerate docs via cargo doc --open when changing public APIs.
Testing & QA
Tests live beside their modules (mod tests blocks). Name tests test_* and focus on serialization, comparison, and metadata coverage when introducing a new value type or record behavior. For fuzz targets, lean on the wp-data-model workspace where fuzz harnesses reside.
Documentation & Support
- Architecture notes:
src/model/README.md - Contributor guide:
AGENTS.md - Issue tracking and releases: GitHub
wp-labs/wp-model-core
License
Distributed under the Elastic License 2.0. See LICENSE for details.