openakb-validate
openakb-validate is the Rust validator crate for OpenAKB descriptor documents. It performs
schema, descriptor-local semantic, and strict-profile structural validation, and it provides
opt-in async content checks for descriptor-related bytes supplied through a resolver.
Status: pre-release.
Installation
cargo add openakb-validate
Quick Start
use openakb_validate::{Mode, validate};
use serde_json::json;
let descriptor = json!({
"$schema": "https://schema.openakb.org/v1/openakb.schema.json",
"id": "example-akb",
"title": "Example AKB",
"description": "A small descriptor for validation examples.",
"sources": [
{
"id": "SRC-000001",
"type": "url",
"uri": "https://docs.example.com/source/"
}
],
"sections": [
{
"id": "SEC-000001",
"title": "Overview",
"description": "A section grounded in the primary source.",
"content_uri": "sections/overview.md",
"source_ids": ["SRC-000001"]
}
]
});
let result = validate(&descriptor, Mode::Strict);
assert!(result.ok());
Content Checks
Content checks are explicit and resolver-backed. LocalFileResolver resolves scheme-less
relative descriptor references under a local base directory.
use openakb_validate::{LocalFileResolver, Mode, validate_with_content};
use serde_json::Value;
# async fn run(descriptor: Value) {
let resolver = LocalFileResolver::new("examples/example-akb");
let report = validate_with_content(&descriptor, &resolver, Mode::Strict).await;
assert!(report.ok());
# }
Compatibility
The minimum supported Rust version is 1.88.
Specification
See the repository specification, schemas,
and conformance fixtures.
License
Apache-2.0. See LICENSE.