Skip to content

Commit

Permalink
Merge 6b30b64 into 910fd1c
Browse files Browse the repository at this point in the history
  • Loading branch information
th1nkful committed Oct 12, 2020
2 parents 910fd1c + 6b30b64 commit af0b90d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## CHANGELOG
Date format is DD/MM/YYYY

## 5.0.0 (12/10/2020)
* Update to use Joi v17.x
* Change from using peerDependency of "@hapi/joi" to "joi"

## 4.0.3 (18/11/2019)
* Fix TypeScript example in the README.

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ using a fixed version.

## Install

You need to install `@hapi/joi` with this module since it relies on it in
You need to install `joi` with this module since it relies on it in
`peerDependencies`.

```
npm i express-joi-validation @hapi/joi --save
npm i express-joi-validation joi --save
```

For TypeScript developers you also need to install Joi types. JavaScript
Expand Down Expand Up @@ -77,7 +77,7 @@ For TypeScript a helper `ValidatedRequest` and
ensure type safety in your handler function.

```ts
import * as Joi from '@hapi/joi'
import * as Joi from 'joi'
import * as express from 'express'
import {
ContainerTypes,
Expand Down Expand Up @@ -117,7 +117,7 @@ You can minimise some duplication by using [joi-extract-type](https://github.com
_NOTE: this does not work with Joi v16+ at the moment. See [this issue](https://github.com/TCMiranda/joi-extract-type/issues/23)._

```ts
import * as Joi from '@hapi/joi'
import * as Joi from 'joi'
import * as express from 'express'
import {
// Use this as a replacement for express.Request
Expand Down Expand Up @@ -249,7 +249,7 @@ Supported options are the same as `validator.query`.

### Joi Versioning
This module uses `peerDependencies` for the Joi version being used.
This means whatever `@hapi/joi` version is in the `dependencies` of your
This means whatever `joi` version is in the `dependencies` of your
`package.json` will be used by this module.


Expand Down
2 changes: 1 addition & 1 deletion example/typescript/route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Joi from '@hapi/joi'
import * as Joi from 'joi'
import formidable from 'express-formidable'
import {
ValidatedRequest,
Expand Down
8 changes: 2 additions & 6 deletions example/typescript/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const port = 3030

import express from 'express'
import * as Joi from '@hapi/joi'
import * as Joi from 'joi'
import HelloWorld from './route'
import { createValidator, ExpressJoiError } from '../../express-joi-validation'

Expand Down Expand Up @@ -43,11 +43,7 @@ app.use(
}
)

app.listen(port, (err: any) => {
if (err) {
throw err
}

app.listen(port, () => {
console.log(`\napp started on ${port}\n`)
console.log(
`Try accessing http://localhost:${port}/ping or http://localhost:${port}/hello?name=dean to get some data.\n`
Expand Down
2 changes: 1 addition & 1 deletion express-joi-validation.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Joi from '@hapi/joi'
import * as Joi from 'joi'
import * as express from 'express'
import { IncomingHttpHeaders } from 'http'
import { ParsedQs } from 'qs'
Expand Down
2 changes: 1 addition & 1 deletion index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const Joi = require('@hapi/joi')
const Joi = require('joi')
const sinon = require('sinon')
const supertest = require('supertest')
const expect = require('chai').expect
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "express-joi-validation",
"version": "4.0.4-beta.0",
"version": "5.0.0-beta.0",
"description": "validate express application inputs and parameters using joi",
"main": "express-joi-validation.js",
"scripts": {
Expand Down Expand Up @@ -29,10 +29,8 @@
"author": "Evan Shortiss",
"license": "MIT",
"devDependencies": {
"@hapi/joi": "~16.1.7",
"@types/express": "~4.0.39",
"@types/express-formidable": "~1.0.4",
"@types/hapi__joi": "~16.0.3",
"@types/node": "~10.14.18",
"@types/qs": "~6.9.3",
"body-parser": "~1.18.3",
Expand All @@ -42,6 +40,7 @@
"express": "~4.16.3",
"express-formidable": "~1.0.0",
"husky": "~1.0.1",
"joi": "~17.2.1",
"joi-extract-type": "~15.0.0",
"lint-staged": "~8.2.1",
"lodash": "~4.17.15",
Expand All @@ -57,7 +56,7 @@
"typescript": "~3.5.2"
},
"peerDependencies": {
"@hapi/joi": "16"
"joi": "17"
},
"engines": {
"node": ">=8.0.0"
Expand Down

0 comments on commit af0b90d

Please sign in to comment.