Skip to main content

openakb_validate/
lib.rs

1//! Validator for OpenAKB agent knowledge base descriptors.
2//!
3//! The crate provides structural validation for parsed descriptors
4//! ([`serde_json::Value`]) against the embedded OpenAKB v1 JSON Schema plus
5//! descriptor-local semantic rules. [`Mode::Strict`] adds `AKB006`
6//! unknown-core-property findings. Opt-in async content checks verify referenced
7//! bytes when a caller supplies a [`Resolver`].
8//!
9//! ```
10//! use openakb_validate::{Mode, validate};
11//! use serde_json::json;
12//!
13//! let descriptor = json!({
14//!     "$schema": "https://schema.openakb.org/v1/openakb.schema.json",
15//!     "id": "example-akb",
16//!     "title": "Example AKB",
17//!     "description": "A tiny descriptor for documentation examples.",
18//!     "sources": [
19//!         {
20//!             "id": "SRC-000001",
21//!             "type": "url",
22//!             "uri": "https://docs.example.com/source/"
23//!         }
24//!     ],
25//!     "sections": [
26//!         {
27//!             "id": "SEC-000001",
28//!             "title": "Overview",
29//!             "description": "A section grounded in the primary source.",
30//!             "content_uri": "sections/overview.md",
31//!             "source_ids": ["SRC-000001"]
32//!         }
33//!     ]
34//! });
35//!
36//! let result = validate(&descriptor, Mode::Strict);
37//! assert!(result.ok());
38//! ```
39
40mod catalog;
41mod citations;
42mod content;
43mod result;
44mod schema;
45mod semantic;
46mod shape;
47mod strict;
48mod validator;
49
50pub use catalog::*;
51pub use citations::*;
52pub use content::*;
53pub use result::*;
54pub use validator::*;