chore(deps): update dependency @types/hapi__joi to v16.0.9 (#3185)

This commit is contained in:
renovate[bot] 2020-02-03 11:32:34 +02:00 committed by GitHub
parent 9c76a140c7
commit b71c496d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 10 deletions

View File

@ -32,7 +32,7 @@
"devDependencies": {
"@types/cors": "^2.8.6",
"@types/express": "^4.17.2",
"@types/hapi__joi": "16.0.6",
"@types/hapi__joi": "16.0.9",
"@types/jest": "^24.9.0",
"@types/morgan": "^1.7.37",
"@types/node": "^13.1.7",

View File

@ -190,13 +190,11 @@ export const joi = (schema: Joi.Schema) => (
next: express.NextFunction,
) => {
const { error } = schema.validate(req.body, { allowUnknown: true });
const valid = error == null;
if (valid) {
next();
} else {
if (error) {
const { details } = error;
const message = details.map(i => i.message).join(',');
res.status(422).json({ error: message });
} else {
next();
}
};

View File

@ -2978,10 +2978,10 @@
"@types/minimatch" "*"
"@types/node" "*"
"@types/hapi__joi@16.0.6":
version "16.0.6"
resolved "https://registry.yarnpkg.com/@types/hapi__joi/-/hapi__joi-16.0.6.tgz#aa8f7dff93fdd3db6506ca2433a8302d8819fad1"
integrity sha512-rpU8FNMGxhYIF6bUlxZYO4drNjqUWCGrf4UINABAJzdcrPs4bP+Bz5VXzp8rOPZsNynnaDXbiU/MyjOGlfeczg==
"@types/hapi__joi@16.0.9":
version "16.0.9"
resolved "https://registry.yarnpkg.com/@types/hapi__joi/-/hapi__joi-16.0.9.tgz#0ad11f9de3753748444ac16249a264fc7c798ab4"
integrity sha512-FV+rJxm4UBxBsRvT5hpiRvnxbpi9iJu4qdwXQvNXf6eXJkcgKGlTwHnstIDAxSTKTUMSmpJnyXpr6XI9X/4SjA==
"@types/history@*":
version "4.7.5"