修改jsonschema校验json数据是否为空等错误信息结构修改
This commit is contained in:
parent
697762157e
commit
8c9015fe06
|
|
@ -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,6 +51,8 @@ local schemaLogin = {
|
|||
properties = {
|
||||
username = { type = "string" },
|
||||
password = { type = "string" },
|
||||
captcha = { type = "string" },
|
||||
checkKey = { type = "string" },
|
||||
},
|
||||
required = { "username", "password" }
|
||||
}
|
||||
|
|
@ -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是否有效
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user