Skip to main content

SchemaProvider

Trait SchemaProvider 

Source
pub trait SchemaProvider: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn name(&self) -> &str;
    fn schema_for(&self, path: &Path) -> Option<SchemaContent>;
}
Expand description

A type that can provide a JSON Schema for a given file path.

Implement this trait for built-in providers and register them via SchemaRegistry::register. Extensions use the RegisterSchema host-request to register schemas dynamically at runtime.

Required Methods§

Source

fn id(&self) -> &str

Stable identifier for this provider (e.g. "cargo-toml").

Source

fn name(&self) -> &str

Human-readable name (e.g. "Cargo.toml schema").

Source

fn schema_for(&self, path: &Path) -> Option<SchemaContent>

Returns the SchemaContent for path if this provider covers it, or None otherwise.

Implementors§