Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from @hapi/joi to joi #119

Merged
merged 1 commit into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/integration/abortEarly.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const { createServer } = require('../../_mocks_/express');

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/body.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const { createServer } = require('../../_mocks_/express');

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/context.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const { createServer } = require('../../_mocks_/express');

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/cookies.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const { createServer } = require('../../_mocks_/express');

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/defaultValues.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const { createServer } = require('../../_mocks_/express');

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/defaults.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const { createServer } = require('../../_mocks_/express');

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/headers.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const { createServer } = require('../../_mocks_/express');

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/keyed.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const { createServer } = require('../../_mocks_/express');

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/params.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const { createServer } = require('../../_mocks_/express');

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/query.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const { createServer } = require('../../_mocks_/express');

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/signed.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const request = require('supertest');
const signature = require('cookie-signature');
const { createServer } = require('../../_mocks_/express');
Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/schema.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const { evSchema } = require('../../lib/ev.js');
const { joiSchema } = require('../../lib/joi.js');

Expand Down
2 changes: 1 addition & 1 deletion lib/ev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const http = require('http');
const Joi = require('@hapi/joi');
const Joi = require('joi');

const evOptions = {
context: false,
Expand Down
2 changes: 1 addition & 1 deletion lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ValidationOptions,
ValidationError as JoiError,
Root as joiRoot,
} from '@hapi/joi';
} from 'joi';

interface EvOptions {
context?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');

const ValidationError = require('./validation-error');
const { mergeJoiOptions, joiSchema } = require('./joi');
Expand Down
2 changes: 1 addition & 1 deletion lib/joi.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Joi = require('@hapi/joi');
const Joi = require('joi');
const { parameters } = require('./parameters');

const schema = parameters
Expand Down
2 changes: 1 addition & 1 deletion load/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const express = require('express');
const Joi = require('@hapi/joi');
const Joi = require('joi');
const bodyParser = require('body-parser');
const { validate, ValidationError } = require('../lib/index');

Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"middleware"
],
"dependencies": {
"@hapi/joi": "17.x.x",
"joi": "17.x.x",
"@types/express": "4.x.x",
"@types/hapi__joi": "16.x.x"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this change to @types/joi? We may need to wait until it gets in sync with the last release of joi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, should probably jump "@types/hapi__joito@types/joi`. But as you mentioned it still hasn't caught up, so that's probably another, later, Pull Request.

This PR should be mergeable now, and would remove the deprecation warning at npm/yarn install time.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: @types/joi, there is a PR to update the types DefinitelyTyped/DefinitelyTyped#46241 but it looks like the progress has stalled.

},
Expand Down