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 true spec violations as Severity::Error, and material data integrity issues, temporal checks, broken references, contract discrepancies, and script syntax errors as Severity::Warning or Severity::Info.
  • lint is the opinionated companion: lint_bundle evaluates 12 bundle formatting, structure, and authoring hygiene rules, each finding tagged with a stable rule code (L1..L12).
  • syntax provides in-process syntax checking for Python, JavaScript, TypeScript, Rust, SQL, JSON, YAML, and Bash.

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 and validation.
syntax
Multi-language syntax validation for Attested Computations and embedded scripts.
validate
Conformance checking and structural validation against OKF v0.2.

Structs§

Diagnostic
A single finding about a bundle.
FencedCodeBlock
A parsed fenced code block from markdown.
ParseSeverityError
Error returned when a string cannot be parsed into a Severity.
Report
The result of validating a bundle.
SyntaxError
A syntax diagnostic produced by static AST parsing.

Enums§

Language
Supported languages for static syntax checking.
Severity
Severity of a diagnostic.

Functions§

check_syntax
Checks the syntax of source for the given language tag or name.
extract_fenced_code_blocks
Extracts all fenced code blocks (delimited by 3+ backticks or 3+ tildes) from markdown text.
lint_bundle
Lints a loaded bundle, returning all findings.
lint_bundle_at
Lints a bundle, returning all opinionated formatting and style findings.
validate_bundle
Validates a loaded bundle, returning all findings.
validate_bundle_at
Validates a bundle, additionally reporting concepts that are stale on today.