Skip to main content

Crate jsonschema_explain

Crate jsonschema_explain 

Source
Expand description

§jsonschema-explain

Crates.io docs.rs GitHub License

Render JSON Schema as human-readable terminal documentation

§Features

  • Man-page-style terminal output from typed jsonschema_schema::SchemaValue schemas
  • ANSI colors with bold headers, dimmed metadata, and highlighted types
  • Syntax-highlighted code blocks in schema descriptions (via markdown-to-ansi)
  • Renders properties, required fields, enums, defaults, oneOf/anyOf/allOf variants
  • Caller-provided width for terminal-aware layout

§Usage

use jsonschema_explain::{explain, ExplainOptions};
use jsonschema_schema::SchemaValue;

let schema: SchemaValue = serde_json::from_str(r#"{"type": "object"}"#).unwrap();
let opts = ExplainOptions { color: true, syntax_highlight: true, width: 120, validation_errors: vec![], extended: false };
let output = explain(&schema, "my-config", &opts);
println!("{output}");

Part of the Lintel project.

§License

Apache-2.0

Structs§

ExplainError
A validation error to display in the VALIDATION ERRORS section.
ExplainOptions
Display options for rendering schema documentation.

Functions§

explain
Render a JSON Schema as human-readable terminal documentation.
explain_at_path
Render a sub-schema at a given JSON Pointer path.
navigate_pointer
Walk a JSON Pointer path through a schema, resolving $ref at each step.
resolve_schema_ref
Resolve a $ref within the same schema document.