修改jsonschema校验json数据是否为空等错误信息结构修改
This commit is contained in:
parent
697762157e
commit
8c9015fe06
|
|
@ -9,13 +9,15 @@ local _M = {}
|
||||||
|
|
||||||
-- 定义一个JSON Schema
|
-- 定义一个JSON Schema
|
||||||
local schemaAuth = {
|
local schemaAuth = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "responseType", type = "string", default = "code"},
|
properties = {
|
||||||
{name = "clientId", type = "string", minLength = 10},
|
response_type = { type = "string" },
|
||||||
{name = "redirectUri", type = "string", minLength = 8},
|
client_id = { type = "string" },
|
||||||
{name = "state", type = "string"},
|
redirect_uri = { type = "string" },
|
||||||
{name = "scope", type = "string"},
|
scope = { type = "string" },
|
||||||
}, required = {"responseType", "clientId", "redirectUri"}}
|
state = { type = "string" },
|
||||||
|
},
|
||||||
|
required = { "response_type", "client_id", "redirect_uri" }
|
||||||
}
|
}
|
||||||
|
|
||||||
--获取授权码
|
--获取授权码
|
||||||
|
|
@ -27,12 +29,13 @@ function _M:validatorAuthorize(jsonData)
|
||||||
end
|
end
|
||||||
|
|
||||||
local schemaToken = {
|
local schemaToken = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "username", type = "string"},
|
properties = {
|
||||||
{name = "password", type = "string"},
|
grant_type = { type = "string" },
|
||||||
{name = "captcha", type = "string"},
|
code = { type = "string" },
|
||||||
{name = "checkKey", type = "string"},
|
redirect_uri = { type = "string" },
|
||||||
}, required = {"username", "password"}}
|
},
|
||||||
|
required = { "grant_type", "code", "redirect_uri" }
|
||||||
}
|
}
|
||||||
|
|
||||||
--根据授权码获取Access-Token
|
--根据授权码获取Access-Token
|
||||||
|
|
@ -48,8 +51,10 @@ local schemaLogin = {
|
||||||
properties = {
|
properties = {
|
||||||
username = { type = "string" },
|
username = { type = "string" },
|
||||||
password = { type = "string" },
|
password = { type = "string" },
|
||||||
|
captcha = { type = "string" },
|
||||||
|
checkKey = { type = "string" },
|
||||||
},
|
},
|
||||||
required = {"username", "password"}
|
required = { "username", "password" }
|
||||||
}
|
}
|
||||||
|
|
||||||
--回收Access-Token
|
--回收Access-Token
|
||||||
|
|
@ -61,12 +66,11 @@ function _M:validatorLogin(jsonData)
|
||||||
end
|
end
|
||||||
|
|
||||||
local schemaUserInfo = {
|
local schemaUserInfo = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "username", type = "string"},
|
properties = {
|
||||||
{name = "password", type = "string"},
|
Authorization = { type = "string" },
|
||||||
{name = "captcha", type = "string"},
|
},
|
||||||
{name = "checkKey", type = "string"},
|
required = { "Authorization" }
|
||||||
}, required = {"username", "password"}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--根据Access-Token获取相应用户的账户信息
|
--根据Access-Token获取相应用户的账户信息
|
||||||
|
|
@ -78,12 +82,11 @@ function _M:validatorUserinfo(jsonData)
|
||||||
end
|
end
|
||||||
|
|
||||||
local schemaLogout = {
|
local schemaLogout = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "username", type = "string"},
|
properties = {
|
||||||
{name = "password", type = "string"},
|
Authorization = { type = "string" },
|
||||||
{name = "captcha", type = "string"},
|
},
|
||||||
{name = "checkKey", type = "string"},
|
required = { "Authorization" }
|
||||||
}, required = {"username", "password"}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--回收Access-Token
|
--回收Access-Token
|
||||||
|
|
@ -95,12 +98,11 @@ function _M:validatorLogout(jsonData)
|
||||||
end
|
end
|
||||||
|
|
||||||
local schemaRefresh = {
|
local schemaRefresh = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "username", type = "string"},
|
properties = {
|
||||||
{name = "password", type = "string"},
|
Authorization = { type = "string" },
|
||||||
{name = "captcha", type = "string"},
|
},
|
||||||
{name = "checkKey", type = "string"},
|
required = { "Authorization" }
|
||||||
}, required = {"username", "password"}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--根据Refresh-Token刷新Access-Token
|
--根据Refresh-Token刷新Access-Token
|
||||||
|
|
@ -112,12 +114,11 @@ function _M:validatorRefresh(jsonData)
|
||||||
end
|
end
|
||||||
|
|
||||||
local schemaChecklogin = {
|
local schemaChecklogin = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "username", type = "string"},
|
properties = {
|
||||||
{name = "password", type = "string"},
|
Authorization = { type = "string" },
|
||||||
{name = "captcha", type = "string"},
|
},
|
||||||
{name = "checkKey", type = "string"},
|
required = { "Authorization" }
|
||||||
}, required = {"username", "password"}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--验证token是否有效
|
--验证token是否有效
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,17 @@ local _M = {}
|
||||||
|
|
||||||
-- 定义一个JSON Schema
|
-- 定义一个JSON Schema
|
||||||
local schema = {
|
local schema = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "name", type = "string"},
|
properties = {
|
||||||
{name = "password", type = "string"},
|
name = { type = "string" },
|
||||||
{name = "real_name", type = "string"},
|
password = { type = "string" },
|
||||||
{name = "department", type = "string"},
|
real_name = { type = "string" },
|
||||||
{name = "office_phone", type = "string"},
|
department = { type = "string" },
|
||||||
{name = "telephone", type = "string"},
|
office_phone = { type = "string" },
|
||||||
{name = "display_name", type = "string"},
|
create_by = { type = "string" },
|
||||||
}, required = {"name"}}
|
update_by = { type = "string" },
|
||||||
|
},
|
||||||
|
required = { "name", "redirect_uris" }
|
||||||
}
|
}
|
||||||
|
|
||||||
function _M.validatorJson(jsonData)
|
function _M.validatorJson(jsonData)
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,18 @@ local _M = {}
|
||||||
|
|
||||||
-- 定义一个JSON Schema
|
-- 定义一个JSON Schema
|
||||||
local schema = {
|
local schema = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "name", type = "string"},
|
properties = {
|
||||||
{name = "display_name", type = "string"},
|
name = { type = "string" },
|
||||||
{name = "logo", type = "string"},
|
display_name = { type = "string" },
|
||||||
{name = "title", type = "string"},
|
logo = { type = "string" },
|
||||||
{name = "name", type = "string"},
|
title = { type = "string" },
|
||||||
{name = "favicon", type = "string"},
|
favicon = { type = "string" },
|
||||||
{name = "description", type = "string"},
|
description = { type = "string" },
|
||||||
{name = "homepage_url", type = "string"},
|
homepage_url = { type = "string" },
|
||||||
{name = "redirect_uris", type = "string"},
|
redirect_uris = { type = "string" },
|
||||||
}, required = {"name", "redirect_uris"}}
|
},
|
||||||
|
required = { "name", "redirect_uris" }
|
||||||
}
|
}
|
||||||
|
|
||||||
function _M.validatorJson(jsonData)
|
function _M.validatorJson(jsonData)
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,18 @@ local _M = {}
|
||||||
|
|
||||||
-- 定义一个JSON Schema
|
-- 定义一个JSON Schema
|
||||||
local schema = {
|
local schema = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "name", type = "string"},
|
properties = {
|
||||||
{name = "seq", type = "string"},
|
name = { type = "string" },
|
||||||
{name = "description", type = "string"},
|
seq = { type = "string" },
|
||||||
{name = "create_by", type = "string"},
|
description = { type = "string" },
|
||||||
{name = "update_by", type = "string"},
|
create_by = { type = "string" },
|
||||||
{name = "parent_id", type = "string"},
|
update_by = { type = "string" },
|
||||||
{name = "leader", type = "string"},
|
parent_id = { type = "string" },
|
||||||
{name = "status", type = "string"},
|
leader = { type = "string" },
|
||||||
}, required = {"name"}}
|
status = { type = "string" },
|
||||||
|
},
|
||||||
|
required = { "name" }
|
||||||
}
|
}
|
||||||
|
|
||||||
function _M.validatorJson(jsonData)
|
function _M.validatorJson(jsonData)
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,14 @@ local _M = {}
|
||||||
|
|
||||||
-- 定义一个JSON Schema
|
-- 定义一个JSON Schema
|
||||||
local schema = {
|
local schema = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "username", type = "string"},
|
properties = {
|
||||||
{name = "password", type = "string"},
|
username = { type = "string" },
|
||||||
{name = "captcha", type = "string"},
|
password = { type = "string" },
|
||||||
{name = "checkKey", type = "string"},
|
captcha = { type = "string" },
|
||||||
}, required = {"username", "password"}}
|
checkKey = { type = "string" },
|
||||||
|
},
|
||||||
|
required = { "username", "password" }
|
||||||
}
|
}
|
||||||
|
|
||||||
function _M.validatorJson(jsonData)
|
function _M.validatorJson(jsonData)
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,15 @@ local _M = {}
|
||||||
|
|
||||||
-- 定义一个JSON Schema
|
-- 定义一个JSON Schema
|
||||||
local schema = {
|
local schema = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "username", type = "string"},
|
properties = {
|
||||||
{name = "phone", type = "string"},
|
permission_name = { type = "string" },
|
||||||
{name = "email", type = "string"},
|
permission_code = { type = "string" },
|
||||||
{name = "idcard", type = "string"},
|
permission_desc = { type = "string" },
|
||||||
{name = "name", type = "string"},
|
create_by = { type = "string" },
|
||||||
{name = "office_phone", type = "string"},
|
update_by = { type = "string" },
|
||||||
{name = "telephone", type = "string"},
|
},
|
||||||
{name = "display_name", type = "string"},
|
required = { "permission_name", "permission_code" }
|
||||||
}, required = {"username", "phone", "email", "idcard"}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _M.validatorJson(jsonData)
|
function _M.validatorJson(jsonData)
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,17 @@ local _M = {}
|
||||||
|
|
||||||
-- 定义一个JSON Schema
|
-- 定义一个JSON Schema
|
||||||
local schema = {
|
local schema = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "post_id", type = "string"},
|
properties = {
|
||||||
{name = "post_code", type = "string"},
|
post_id = { type = "string" },
|
||||||
{name = "post_name", type = "string"},
|
post_code = { type = "string" },
|
||||||
{name = "post_sort", type = "number"},
|
post_name = { type = "string" },
|
||||||
{name = "status", type = "string"},
|
post_sort = { type = "number" },
|
||||||
{name = "create_by", type = "string"},
|
status = { type = "string" },
|
||||||
{name = "update_by", type = "string"},
|
create_by = { type = "string" },
|
||||||
}, required = {"post_id"}}
|
update_by = { type = "string" },
|
||||||
|
},
|
||||||
|
required = { "post_id" }
|
||||||
}
|
}
|
||||||
|
|
||||||
function _M.validatorJson(jsonData)
|
function _M.validatorJson(jsonData)
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,14 @@ local _M = {}
|
||||||
|
|
||||||
-- 定义一个JSON Schema
|
-- 定义一个JSON Schema
|
||||||
local schema = {
|
local schema = {
|
||||||
{type = "object", properties = {
|
type = "object",
|
||||||
{name = "role_name", type = "string"},
|
properties = {
|
||||||
{name = "description", type = "string"},
|
role_name = { type = "string" },
|
||||||
{name = "create_by", type = "string"},
|
description = { type = "string" },
|
||||||
{name = "update_by", type = "string"},
|
create_by = { type = "string" },
|
||||||
}, required = {"role_name"}}
|
update_by = { type = "string" },
|
||||||
|
},
|
||||||
|
required = { "role_name" }
|
||||||
}
|
}
|
||||||
|
|
||||||
function _M.validatorJson(jsonData)
|
function _M.validatorJson(jsonData)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user