Skip to main content

Config

Struct Config 

Source
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: bool

Mark 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: bool

Disable 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

Source

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.

Source

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 Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Config

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Config

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,