AuthPlatform/src/validator/system/department.lua

32 lines
938 B
Lua

---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by .
--- DateTime: 2025/10/30 08:12
--- 业务逻辑 对组织架构数据进行参数数据的验证
local jsonschema = require("jsonschema")
local _M = {}
-- 定义一个JSON Schema
local schema = {
{type = "object", properties = {
{name = "name", type = "string"},
{name = "seq", type = "string"},
{name = "description", type = "string"},
{name = "create_by", type = "string"},
{name = "update_by", type = "string"},
{name = "parent_id", type = "string"},
{name = "leader", type = "string"},
{name = "status", type = "string"},
}, required = {"name"}}
}
function _M.validatorJson(jsonData)
-- 验证数据是否符合schema
local validator = jsonschema.generate_validator(schema)
local result = validator(jsonData)
return result
end
return _M