pub struct Schema {
pub schema_version: u32,
pub label: String,
pub description: Option<String>,
pub params: BTreeMap<String, ParamSpec>,
pub attaches_to: Vec<String>,
pub body: BodyShape,
pub verbatim_label: bool,
pub capabilities: Capabilities,
pub hooks: HookSet,
pub handler: Option<HandlerSpec>,
pub diagnostics: Vec<DiagnosticDecl>,
}Expand description
One label’s schema. Mirrors the YAML format documented in the Extending Lex proposal §13.2.
Schemas are strict on deserialise: unknown fields are rejected. Forward
compatibility lives at the wire_version axis, not at the schema-format
level — a schema with a field this version doesn’t know about is
malformed by definition. The schema loader (lex-extension-host)
surfaces this as a precise SchemaError.
Fields§
§schema_version: u32Schema-format version. Currently 1.
label: StringFully-qualified label, e.g. "acme.commenting".
description: Option<String>§params: BTreeMap<String, ParamSpec>Declared parameters, keyed by name.
attaches_to: Vec<String>Permitted host node kinds.
body: BodyShapeBody shape when the label is used as an annotation.
verbatim_label: boolWhether the label is also legal as a verbatim block closing.
capabilities: CapabilitiesDeclared OS-level capabilities the handler needs. Honoured once sandboxing is in place; see proposal §8.
hooks: HookSetHooks the label participates in.
handler: Option<HandlerSpec>Optional handler delivery info. Schema-only labels (validation + editor UX from the schema alone) omit this.
diagnostics: Vec<DiagnosticDecl>Diagnostic codes this label’s handler can emit. Declaring them
lets the host schema-validate [diagnostics.rules] entries
against the resolved registry — a <namespace>.<code> rule
whose <code> matches nothing declared here is a dead letter
the host can flag — and lets config/editor tooling surface the
available codes with their descriptions and default severity.