pub struct Config {
pub root: bool,
pub exclude: Vec<String>,
pub schemas: HashMap<String, String>,
pub no_default_catalog: bool,
pub registries: Vec<String>,
pub rewrite: HashMap<String, String>,
pub overrides: Vec<Override>,
pub format: Option<Format>,
}Expand description
Configuration file for the Lintel JSON/YAML schema validator.
Lintel walks up the directory tree from the validated file looking for
lintel.toml files and merges them together. Settings in child directories
take priority over parent directories. Set root = true to stop the upward
search.
Place lintel.toml at your project root (or any subdirectory that needs
different settings).
Fields§
§root: boolMark this configuration file as the project root.
When true, Lintel stops walking up the directory tree and will not
merge any lintel.toml files from parent directories. Use this at your
repository root to prevent inheriting settings from enclosing
directories.
exclude: Vec<String>Glob patterns for files to exclude from validation.
Matched against file paths relative to the working directory. Standard
glob syntax is supported: * matches within a single directory, **
matches across directory boundaries.
schemas: HashMap<String, String>Custom schema-to-file mappings.
Keys are glob patterns matched against file paths; values are schema
URLs (or //-prefixed local paths) to apply. These mappings take
priority over catalog auto-detection but are overridden by inline
$schema properties and YAML modeline comments.
Example:
[schemas]
"config/*.yaml" = "https://json.schemastore.org/github-workflow.json"
"myschema.json" = "//schemas/custom.json"no_default_catalog: boolDisable the built-in Lintel catalog.
When true, only SchemaStore and any additional registries listed in
registries are used for schema auto-detection. The default Lintel
catalog (which provides curated schema mappings) is skipped.
registries: Vec<String>Additional schema catalog URLs to fetch alongside SchemaStore.
Each entry should be a URL pointing to a JSON file in SchemaStore
catalog format ({"schemas": [...]}).
Registries from child configs appear first, followed by parent registries (duplicates are removed). This lets child directories add project-specific catalogs while inheriting organization-wide ones.
rewrite: HashMap<String, String>Schema URI rewrite rules.
Keys are URI prefixes to match; values are replacement prefixes. The
longest matching prefix wins. Use // as a value prefix to reference
paths relative to the directory containing lintel.toml.
Example:
[rewrite]
"http://localhost:8000/" = "//schemas/"This rewrites http://localhost:8000/foo.json to
//schemas/foo.json, which then resolves to a local file relative to
the config directory.
overrides: Vec<Override>Per-file or per-schema override rules.
In TOML, each override is written as a [[override]] block (double
brackets). Earlier entries take priority; child config overrides come
before parent config overrides after merging.
format: Option<Format>Formatting configuration for lintel format.
Implementations§
Source§impl Config
impl Config
Sourcepub fn find_schema_mapping(&self, path: &str, file_name: &str) -> Option<&str>
pub fn find_schema_mapping(&self, path: &str, file_name: &str) -> Option<&str>
Find a custom schema mapping for the given file path.
Matches against the [schemas] table using glob patterns.
Returns the schema URL if a match is found.
Sourcepub fn should_validate_formats(&self, path: &str, schema_uris: &[&str]) -> bool
pub fn should_validate_formats(&self, path: &str, schema_uris: &[&str]) -> bool
Check whether format validation should be enabled for a given file.
path is the instance file path. schema_uris is a slice of schema
URIs to match against (typically the original URI before rewrites and
the resolved URI after rewrites + // resolution).
Returns false if any matching [[override]] sets
validate_formats = false. Defaults to true when no override matches.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Config
impl JsonSchema for Config
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more