AuthPlatform/src/validator/system/application.lua

35 lines
953 B
Lua

---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by .
--- DateTime: 2025/10/30 08:14
--- 业务逻辑 对应用数据参数进行数据的验证
local jsonschema = require("jsonschema")
local _M = {}
-- 定义一个JSON Schema
local schema = {
type = "object",
properties = {
name = { type = "string" },
display_name = { type = "string" },
logo = { type = "string" },
title = { type = "string" },
favicon = { type = "string" },
description = { type = "string" },
homepage_url = { type = "string" },
redirect_uri = { type = "string" },
},
required = { "name", "redirect_uri" }
}
function _M.validateJson(jsonData)
-- 验证数据是否符合schema
print("jsondata:", jsonData)
local validator = jsonschema.generate_validator(schema)
local result = validator(jsonData)
return result
end
return _M