lintel-config 0.0.2

Configuration types and loader for Lintel (lintel.toml)
Documentation

lintel-config

Crates.io docs.rs License

Configuration types and loader for Lintel. Defines the lintel.toml schema, parses config files, and provides utilities for schema URI rewriting and path resolution.

Features

  • Config typesConfig and Override structs with serde deserialization and JSON Schema generation via schemars
  • Hierarchical loading — walks up the directory tree merging lintel.toml files until root = true
  • URI rewriting — prefix-based rewrite rules with longest-prefix-wins semantics
  • // path resolution — resolve //-prefixed paths relative to the config directory
  • Schema generation — generates the JSON Schema for lintel.toml (used at build time by lintel-check and as a standalone binary)

Usage

use lintel_config::{Config, find_and_load, apply_rewrites, resolve_double_slash};

// Load config by walking up from a directory
let config = find_and_load(std::path::Path::new("."))?
    .unwrap_or_default();

// Check for custom schema mappings
if let Some(url) = config.find_schema_mapping("src/config.json", "config.json") {
    println!("Schema: {url}");
}

// Apply rewrite rules and resolve // paths
let uri = apply_rewrites("http://localhost:8000/schema.json", &config.rewrite);
let uri = resolve_double_slash(&uri, std::path::Path::new("/project"));

Standalone binary

cargo run -p lintel-config

Prints the JSON Schema for lintel.toml to stdout.