]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Add missing
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 18 Nov 2025 14:14:47 +0000 (14:14 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 18 Nov 2025 14:14:47 +0000 (14:14 +0000)
lualib/lua_shape/plugin_schema.lua [new file with mode: 0644]

diff --git a/lualib/lua_shape/plugin_schema.lua b/lualib/lua_shape/plugin_schema.lua
new file mode 100644 (file)
index 0000000..9e74f32
--- /dev/null
@@ -0,0 +1,18 @@
+local Registry = require "lua_shape.registry"
+
+local M = {}
+local global_registry = Registry.global()
+
+function M.register(id, schema)
+  if not id or not schema then
+    error("plugin_schema.register requires id and schema")
+  end
+
+  if not global_registry:get(id) then
+    global_registry:define(id, schema)
+  end
+
+  return global_registry:get(id)
+end
+
+return M