Expand description
Validator for OpenAKB agent knowledge base descriptors.
The crate provides structural validation for parsed descriptors
(serde_json::Value) against the embedded OpenAKB v1 JSON Schema plus
descriptor-local semantic rules. Mode::Strict adds AKB006
unknown-core-property findings. Opt-in async content checks verify referenced
bytes when a caller supplies a Resolver.
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 tiny descriptor for documentation 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());Structs§
- Advisory
- A non-fatal validation advisory.
- Citation
- One recognized inline citation marker, with source ids in written order.
- Content
Check - One content check and its three-state outcome.
- Content
Report - Aggregate result for opt-in content checks.
- Finding
- A validation finding with a stable diagnostic code.
- Full
Report - Combined structural and opt-in content validation result.
- Local
File Resolver - Resolves scheme-less relative paths under a local base directory.
- Unfetchable
- A resolver-level fetch failure.
- Validation
Result - Complete validation outcome.
Enums§
- Check
Kind - Content check category.
- Code
- Stable OpenAKB diagnostic code.
- Mode
- Validation mode.
- Outcome
- Three-state outcome for a content check.
- Segment
- One segment in a JSON Pointer path.
Constants§
- CITE_
ID_ CHARSET - Inline
[cite:]id-token characters (spec §4.4): a case-insensitive superset of the typed source-id form. Hyphen last so this doubles as a regex class body. - CITE_
ID_ MAX_ LENGTH - Maximum length of an inline
[cite:]id token (spec §4.4). - PARENT_
DEPTH_ MAX - Maximum allowed depth for parent chains.
- STRUCTURAL_
DEPTH_ MAX - Maximum structural nesting depth a descriptor may reach before
crate::validatedeclines the recursive schema walk and reportsAKB011instead of risking a stack-overflow abort.
Traits§
- Resolver
- Fetches descriptor-related content bytes.
Functions§
- check_
content - Runs opt-in content checks against fetched descriptor resources.
- extract_
citations - Extract one citation entry per recognized marker in Markdown source order.
- json_
pointer - Builds an RFC 6901 JSON Pointer from path segments.
- validate
- Validates a parsed OpenAKB descriptor against the embedded schema and descriptor-local semantic rules.
- validate_
with_ content - Runs structural validation and opt-in content checks.