diff --git a/src/validator/oauth/oauth.lua b/src/validator/oauth/oauth.lua index 64095b6..bb27839 100644 --- a/src/validator/oauth/oauth.lua +++ b/src/validator/oauth/oauth.lua @@ -9,13 +9,15 @@ local _M = {} -- 定义一个JSON Schema local schemaAuth = { - {type = "object", properties = { - {name = "responseType", type = "string", default = "code"}, - {name = "clientId", type = "string", minLength = 10}, - {name = "redirectUri", type = "string", minLength = 8}, - {name = "state", type = "string"}, - {name = "scope", type = "string"}, - }, required = {"responseType", "clientId", "redirectUri"}} + type = "object", + properties = { + response_type = { type = "string" }, + client_id = { type = "string" }, + redirect_uri = { type = "string" }, + scope = { type = "string" }, + state = { type = "string" }, + }, + required = { "response_type", "client_id", "redirect_uri" } } --获取授权码 @@ -27,12 +29,13 @@ function _M:validatorAuthorize(jsonData) end local schemaToken = { - {type = "object", properties = { - {name = "username", type = "string"}, - {name = "password", type = "string"}, - {name = "captcha", type = "string"}, - {name = "checkKey", type = "string"}, - }, required = {"username", "password"}} + type = "object", + properties = { + grant_type = { type = "string" }, + code = { type = "string" }, + redirect_uri = { type = "string" }, + }, + required = { "grant_type", "code", "redirect_uri" } } --根据授权码获取Access-Token @@ -48,8 +51,10 @@ local schemaLogin = { properties = { username = { type = "string" }, password = { type = "string" }, + captcha = { type = "string" }, + checkKey = { type = "string" }, }, - required = {"username", "password"} + required = { "username", "password" } } --回收Access-Token @@ -61,12 +66,11 @@ function _M:validatorLogin(jsonData) end local schemaUserInfo = { - {type = "object", properties = { - {name = "username", type = "string"}, - {name = "password", type = "string"}, - {name = "captcha", type = "string"}, - {name = "checkKey", type = "string"}, - }, required = {"username", "password"}} + type = "object", + properties = { + Authorization = { type = "string" }, + }, + required = { "Authorization" } } --根据Access-Token获取相应用户的账户信息 @@ -78,12 +82,11 @@ function _M:validatorUserinfo(jsonData) end local schemaLogout = { - {type = "object", properties = { - {name = "username", type = "string"}, - {name = "password", type = "string"}, - {name = "captcha", type = "string"}, - {name = "checkKey", type = "string"}, - }, required = {"username", "password"}} + type = "object", + properties = { + Authorization = { type = "string" }, + }, + required = { "Authorization" } } --回收Access-Token @@ -95,12 +98,11 @@ function _M:validatorLogout(jsonData) end local schemaRefresh = { - {type = "object", properties = { - {name = "username", type = "string"}, - {name = "password", type = "string"}, - {name = "captcha", type = "string"}, - {name = "checkKey", type = "string"}, - }, required = {"username", "password"}} + type = "object", + properties = { + Authorization = { type = "string" }, + }, + required = { "Authorization" } } --根据Refresh-Token刷新Access-Token @@ -112,12 +114,11 @@ function _M:validatorRefresh(jsonData) end local schemaChecklogin = { - {type = "object", properties = { - {name = "username", type = "string"}, - {name = "password", type = "string"}, - {name = "captcha", type = "string"}, - {name = "checkKey", type = "string"}, - }, required = {"username", "password"}} + type = "object", + properties = { + Authorization = { type = "string" }, + }, + required = { "Authorization" } } --验证token是否有效 diff --git a/src/validator/system/account.lua b/src/validator/system/account.lua index f86474c..821fd33 100644 --- a/src/validator/system/account.lua +++ b/src/validator/system/account.lua @@ -9,15 +9,17 @@ local _M = {} -- 定义一个JSON Schema local schema = { - {type = "object", properties = { - {name = "name", type = "string"}, - {name = "password", type = "string"}, - {name = "real_name", type = "string"}, - {name = "department", type = "string"}, - {name = "office_phone", type = "string"}, - {name = "telephone", type = "string"}, - {name = "display_name", type = "string"}, - }, required = {"name"}} + type = "object", + properties = { + name = { type = "string" }, + password = { type = "string" }, + real_name = { type = "string" }, + department = { type = "string" }, + office_phone = { type = "string" }, + create_by = { type = "string" }, + update_by = { type = "string" }, + }, + required = { "name", "redirect_uris" } } function _M.validatorJson(jsonData) diff --git a/src/validator/system/application.lua b/src/validator/system/application.lua index 34b47b0..f01ed0b 100644 --- a/src/validator/system/application.lua +++ b/src/validator/system/application.lua @@ -9,17 +9,18 @@ local _M = {} -- 定义一个JSON Schema local schema = { - {type = "object", properties = { - {name = "name", type = "string"}, - {name = "display_name", type = "string"}, - {name = "logo", type = "string"}, - {name = "title", type = "string"}, - {name = "name", type = "string"}, - {name = "favicon", type = "string"}, - {name = "description", type = "string"}, - {name = "homepage_url", type = "string"}, - {name = "redirect_uris", type = "string"}, - }, required = {"name", "redirect_uris"}} + 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_uris = { type = "string" }, + }, + required = { "name", "redirect_uris" } } function _M.validatorJson(jsonData) diff --git a/src/validator/system/department.lua b/src/validator/system/department.lua index d2d3391..c0601d7 100644 --- a/src/validator/system/department.lua +++ b/src/validator/system/department.lua @@ -9,16 +9,18 @@ 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"}} + 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) diff --git a/src/validator/system/login.lua b/src/validator/system/login.lua index 9226ce2..8fc3a0c 100644 --- a/src/validator/system/login.lua +++ b/src/validator/system/login.lua @@ -9,12 +9,14 @@ local _M = {} -- 定义一个JSON Schema local schema = { - {type = "object", properties = { - {name = "username", type = "string"}, - {name = "password", type = "string"}, - {name = "captcha", type = "string"}, - {name = "checkKey", type = "string"}, - }, required = {"username", "password"}} + type = "object", + properties = { + username = { type = "string" }, + password = { type = "string" }, + captcha = { type = "string" }, + checkKey = { type = "string" }, + }, + required = { "username", "password" } } function _M.validatorJson(jsonData) diff --git a/src/validator/system/permission.lua b/src/validator/system/permission.lua index 0b3d4fe..32ea93d 100644 --- a/src/validator/system/permission.lua +++ b/src/validator/system/permission.lua @@ -9,16 +9,15 @@ local _M = {} -- 定义一个JSON Schema local schema = { - {type = "object", properties = { - {name = "username", type = "string"}, - {name = "phone", type = "string"}, - {name = "email", type = "string"}, - {name = "idcard", type = "string"}, - {name = "name", type = "string"}, - {name = "office_phone", type = "string"}, - {name = "telephone", type = "string"}, - {name = "display_name", type = "string"}, - }, required = {"username", "phone", "email", "idcard"}} + type = "object", + properties = { + permission_name = { type = "string" }, + permission_code = { type = "string" }, + permission_desc = { type = "string" }, + create_by = { type = "string" }, + update_by = { type = "string" }, + }, + required = { "permission_name", "permission_code" } } function _M.validatorJson(jsonData) diff --git a/src/validator/system/position.lua b/src/validator/system/position.lua index 7d50931..7f150fc 100644 --- a/src/validator/system/position.lua +++ b/src/validator/system/position.lua @@ -9,15 +9,17 @@ local _M = {} -- 定义一个JSON Schema local schema = { - {type = "object", properties = { - {name = "post_id", type = "string"}, - {name = "post_code", type = "string"}, - {name = "post_name", type = "string"}, - {name = "post_sort", type = "number"}, - {name = "status", type = "string"}, - {name = "create_by", type = "string"}, - {name = "update_by", type = "string"}, - }, required = {"post_id"}} + type = "object", + properties = { + post_id = { type = "string" }, + post_code = { type = "string" }, + post_name = { type = "string" }, + post_sort = { type = "number" }, + status = { type = "string" }, + create_by = { type = "string" }, + update_by = { type = "string" }, + }, + required = { "post_id" } } function _M.validatorJson(jsonData) diff --git a/src/validator/system/role.lua b/src/validator/system/role.lua index 4b90772..33256ef 100644 --- a/src/validator/system/role.lua +++ b/src/validator/system/role.lua @@ -9,12 +9,14 @@ local _M = {} -- 定义一个JSON Schema local schema = { - {type = "object", properties = { - {name = "role_name", type = "string"}, - {name = "description", type = "string"}, - {name = "create_by", type = "string"}, - {name = "update_by", type = "string"}, - }, required = {"role_name"}} + type = "object", + properties = { + role_name = { type = "string" }, + description = { type = "string" }, + create_by = { type = "string" }, + update_by = { type = "string" }, + }, + required = { "role_name" } } function _M.validatorJson(jsonData)