AuthPlatform/src/validator/system/department.lua

34 lines
900 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 = { type = "string" },
seq = { type = "string" },
description = { type = "string" },
create_by = { type = "string" },
update_by = { type = "string" },
parent_id = { type = "string" },
leader = { type = "string" },
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