Skip to content

Commit

Permalink
Merge pull request #3 from tinacious/upgrade-joi
Browse files Browse the repository at this point in the history
Upgrade to @hapi/joi package
  • Loading branch information
tinacious authored May 25, 2019
2 parents 4f77828 + 5f297f9 commit 8b1b5d6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 36 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
language: node_js
node_js:
- "6"
script:
- npm test
- npm run coverage-ci
- npm run coverage-ci
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ app.get('/contacts/:id', contactsHandler);
To implement route validation, simply call the provided validation function with the desired schema that uses Joi:

```js
const Joi = require('@hapi/joi');
const validate = require('express-joi-validate');

const contactSchema = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"supertest": "^4.0.0"
},
"dependencies": {
"joi": "^v14.3.1"
"@hapi/joi": "^v15.0.3"
}
}
4 changes: 2 additions & 2 deletions tests/mock-server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const express = require('express');
const Joi = require('joi');
const Joi = require('@hapi/joi');

const validate = require('../validate');

Expand Down Expand Up @@ -33,4 +33,4 @@ app.post('/contacts', validate({
}), (req, res) => res.send('ok'));


module.exports = app;
module.exports = app;
4 changes: 2 additions & 2 deletions validate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('joi');
const Joi = require('@hapi/joi');


/**
Expand Down Expand Up @@ -39,4 +39,4 @@ const validate = (schema) => (
);


module.exports = validate;
module.exports = validate;
50 changes: 22 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
# yarn lockfile v1


"@hapi/[email protected]":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.0.0.tgz#9f05469c88cb2fd3dcd624776b54ee95c312126a"

"@hapi/[email protected]":
version "6.2.3"
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-6.2.3.tgz#0abff7ac75d0c5388d2829c464b2aff74d473721"

"@hapi/joi@^v15.0.3":
version "15.0.3"
resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-15.0.3.tgz#e94568fd859e5e945126d5675e7dd218484638a7"
dependencies:
"@hapi/address" "2.x.x"
"@hapi/hoek" "6.x.x"
"@hapi/topo" "3.x.x"

"@hapi/[email protected]":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-3.1.0.tgz#5c47cd9637c2953db185aa957a27bcb2a8b7a6f8"
dependencies:
"@hapi/hoek" "6.x.x"

abbrev@1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
Expand Down Expand Up @@ -732,10 +754,6 @@ [email protected]:
version "1.2.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"

[email protected]:
version "6.1.2"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-6.1.2.tgz#99e6d070561839de74ee427b61aa476bd6bddfd6"

homedir-polyfill@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8"
Expand Down Expand Up @@ -915,12 +933,6 @@ [email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"

[email protected]:
version "3.2.0"
resolved "https://registry.yarnpkg.com/isemail/-/isemail-3.2.0.tgz#59310a021931a9fb06bbb51e155ce0b3f236832c"
dependencies:
punycode "2.x.x"

isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
Expand Down Expand Up @@ -954,14 +966,6 @@ istanbul@^0.4.5:
which "^1.1.1"
wordwrap "^1.0.0"

joi@^v14.3.1:
version "14.3.1"
resolved "https://registry.yarnpkg.com/joi/-/joi-14.3.1.tgz#164a262ec0b855466e0c35eea2a885ae8b6c703c"
dependencies:
hoek "6.x.x"
isemail "3.x.x"
topo "3.x.x"

[email protected]:
version "3.12.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
Expand Down Expand Up @@ -1371,10 +1375,6 @@ pump@^3.0.0:
end-of-stream "^1.1.0"
once "^1.3.1"

[email protected]:
version "2.1.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"

[email protected]:
version "6.5.2"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
Expand Down Expand Up @@ -1721,12 +1721,6 @@ to-regex@^3.0.1, to-regex@^3.0.2:
regex-not "^1.0.2"
safe-regex "^1.1.0"

[email protected]:
version "3.0.3"
resolved "https://registry.yarnpkg.com/topo/-/topo-3.0.3.tgz#d5a67fb2e69307ebeeb08402ec2a2a6f5f7ad95c"
dependencies:
hoek "6.x.x"

type-check@~0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72"
Expand Down

0 comments on commit 8b1b5d6

Please sign in to comment.