modelith-plugin-protocol
The contract between Modelith and its plugins, as Rust types:
the plugin manifest, rule files, the messages a browser plugin exchanges with the host,
text edits and diagnostics, and plugin registry entries.
These types are the single source of truth. The JSON Schemas and the TypeScript types in
@modelith/plugin-sdk are generated from them.
Modelith (the host) and the plugin registry's CI depend on this crate.
Pre-1.0 (apiVersion "0"): the contract may still change between minor releases.
Example
use ;
let manifest: PluginManifest = from_str
.expect;
assert_eq!;
assert_eq!;
assert!;
Manifests and rule files reject unknown fields, so a typo is an error rather than silently ignored. Messages ignore unknown fields, so a host and a plugin of different versions keep working when either adds an optional field.
Features
| Feature | Default | What it adds |
|---|---|---|
codegen |
off | schemars::JsonSchema and ts_rs::TS for every type, and the generate module that writes the JSON Schemas and TypeScript types |
Without codegen the crate depends only on serde and serde_json.
License
MIT