Expand description
User-facing walkthrough: ../../dmc-docs/dmc-schema/
Run cargo doc --open -p dmc-schema for the inline rustdoc.
Schema builder. s::*
use dmc_schema::{s, BoxSchema, Ctx, Schema};
use serde_json::json;
let schema = s::object(vec![
("title".into(), s::string().max(99).boxed()),
("draft".into(), s::default_(s::boolean().boxed(), json!(false)).boxed()),
]);
let ctx = Ctx::empty();
let out = schema.parse(&json!({"title": "Hello"}), &ctx).unwrap();
assert_eq!(out["title"], "Hello");
assert_eq!(out["draft"], false);Modules§
Structs§
- Array
Schema - Asset
Pipeline - Boolean
Schema - Coerce
Schema - Ctx
- Default
Schema - Discriminated
Union Schema - Enum
Schema - Excerpt
Schema - File
Schema - Image
Schema - Intersection
Schema - Isodate
Schema - Literal
Schema - Markdown
Schema - MdxSchema
- Metadata
Schema - Nullable
Schema - Number
Schema - Object
Schema - Optional
Schema - Path
Schema - RawSchema
- Record
Schema - Refine
Schema - Slug
Schema - String
Schema - Super
Refine Schema - TocSchema
- Transform
Schema - Tuple
Schema - Union
Schema - Unique
Schema - Validation
Error
Enums§
Traits§
Functions§
Type Aliases§
- Refine
Predicate Ok(())passes;Err(msg)surfaces a single root-level error.- Super
Refine Predicate - Pushes zero or more errors into the caller-provided buffer.