Skip to main content

Crate okf_validator

Crate okf_validator 

Source
Expand description

§okf-validator: conformance checking and linting for OKF bundles

Companion to okf-core, the pure-Rust implementation of the Open Knowledge Format (OKF) v0.2. This crate judges bundles; okf-core models them.

  • validate checks conformance: validate_bundle reports only true spec violations as Severity::Error, with optional-family problems surfaced as warnings and infos, never as rejections.
  • lint is the opinionated companion: lint_bundle goes beyond conformance and flags the hygiene issues a continuously-authored corpus drifts into, each finding tagged with a stable rule code.

Staleness checks depend on the wall clock, so they are opt-in via validate_bundle_at and lint_bundle_at, which take the date to compare against; the plain variants are deterministic.

Most users get this crate through the okf crate, which re-exports it alongside okf-core and ships the okf CLI.

use okf_core::Bundle;
use okf_validator::validate_bundle;

let bundle = Bundle::load("./my_bundle")?;
let report = validate_bundle(&bundle);
if report.is_conformant() {
    println!("conformant OKF v0.2 bundle");
}

Modules§

lint
Opinionated bundle health checks, beyond conformance.
validate
Conformance checking against OKF v0.2.

Structs§

Diagnostic
A single finding about a bundle.
Report
The result of validating a bundle.

Enums§

Severity
Severity of a diagnostic.

Functions§

lint_bundle
Lints a loaded bundle, returning all findings.
lint_bundle_at
Lints a bundle, additionally flagging concepts that are stale on today.
validate_bundle
Validates a loaded bundle, returning all findings.
validate_bundle_at
Validates a bundle, additionally reporting concepts that are stale on today.