seam_core/lib.rs
1//! The Seam validation engine. Every binding is a translation layer over this
2//! crate and contains no validation logic of its own. If a binding starts
3//! growing rules, that is a leak here, to be fixed here.
4//!
5//! ```
6//! use seam_core::{parser::parse, validate::validate, value::Value, Limits};
7//! use std::collections::BTreeMap;
8//!
9//! let schema = parse("schema Signup { when: DateTime }")?;
10//!
11//! let mut payload = BTreeMap::new();
12//! payload.insert("when".to_string(), Value::String("2026-08-29T14:30:00".into()));
13//!
14//! let err = validate(&schema, "Signup", &Value::Object(payload), Limits::DEFAULT)
15//! .unwrap_err();
16//! assert_eq!(err.issues[0].code.as_str(), "missing_timezone");
17//! # Ok::<(), seam_core::parser::ParseError>(())
18//! ```
19
20#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used, clippy::panic))]
21
22pub mod datetime;
23pub mod error;
24pub mod format;
25pub mod input;
26pub mod json;
27pub mod limits;
28pub mod parser;
29pub mod schema;
30pub mod validate;
31pub mod value;
32
33pub use error::{Code, Issue, Path, Segment, ValidationError};
34pub use format::Format;
35pub use limits::Limits;
36pub use parser::parse;
37pub use schema::{Field, IntType, IntWidth, ObjectType, Presence, Rule, Schema, Type};
38pub use validate::validate;
39pub use value::{Int, Slot, Value};
40
41pub const VERSION: &str = env!("CARGO_PKG_VERSION");