From 83e4a9f758fde2822e3b63b6b9e28a5786df0b7e Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sat, 13 Dec 2025 23:22:53 +0100 Subject: [PATCH] Plugin schema and WsMessage json --- plugin-schema.json | 42 ++++++++++++++++++++++++++++++++++++++++++ src/types.rs | 1 + 2 files changed, 43 insertions(+) create mode 100644 plugin-schema.json diff --git a/plugin-schema.json b/plugin-schema.json new file mode 100644 index 0000000..d9a6804 --- /dev/null +++ b/plugin-schema.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": [ + "id", + "version", + "supported_versions", + "file", + "args" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique plugin identifier (recommended to be lowercase and use author/plugin format)", + "minLength": 1 + }, + "version": { + "type": "string", + "description": "Plugin version", + "pattern": "^\\d+\\.\\d+\\.\\d+$" + }, + "supported_versions": { + "type": "array", + "description": "List of supported host versions", + "items": { + "type": "string" + } + }, + "file": { + "type": "string", + "description": "Executable or runtime used to launch the plugin" + }, + "args": { + "type": "array", + "description": "Arguments passed to the executable", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false +} diff --git a/src/types.rs b/src/types.rs index f6d7961..a28b3bd 100644 --- a/src/types.rs +++ b/src/types.rs @@ -129,6 +129,7 @@ pub mod message { /// WebSocket wrapper #[derive(Debug, Clone, Serialize)] + #[serde(tag = "type", content = "params", rename_all = "snake_case")] pub enum WsMessage Deserialize<'de>> { Message(T), Binary(Vec),