You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/pipes.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -229,13 +229,13 @@ This is, of course, exactly the use case for which pipes are designed. So let's
229
229
230
230
There are several approaches available for doing object validation in a clean, [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) way. One common approach is to use **schema-based** validation. Let's go ahead and try that approach.
231
231
232
-
The [Joi](https://github.com/hapijs/joi) library allows you to create schemas in a straightforward way, with a readable API. Let's build a validation pipe that makes use of Joi-based schemas.
232
+
The [Joi](https://github.com/sideway/joi) library allows you to create schemas in a straightforward way, with a readable API. Let's build a validation pipe that makes use of Joi-based schemas.
233
233
234
234
Start by installing the required package:
235
235
236
236
```bash
237
-
$ npm install --save @hapi/joi
238
-
$ npm install --save-dev @types/hapi__joi
237
+
$ npm install --save joi
238
+
$ npm install --save-dev @types/joi
239
239
```
240
240
241
241
In the code sample below, we create a simple class that takes a schema as a `constructor` argument. We then apply the `schema.validate()` method, which validates our incoming argument against the provided schema.
@@ -247,7 +247,7 @@ In the next section, you'll see how we supply the appropriate schema for a given
Copy file name to clipboardExpand all lines: content/techniques/configuration.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -311,23 +311,23 @@ export class DatabaseModule {}
311
311
312
312
It is standard practice to throw an exception during application startup if required environment variables haven't been provided or if they don't meet certain validation rules. The `@nestjs/config` package enables two different ways to do this:
313
313
314
-
-[Joi](https://github.com/hapijs/joi) built-in validator. With Joi, you define an object schema and validate JavaScript objects against it.
314
+
-[Joi](https://github.com/sideway/joi) built-in validator. With Joi, you define an object schema and validate JavaScript objects against it.
315
315
- A custom `validate()` function which takes environment variables as an input.
316
316
317
317
To use Joi, we must install Joi package (and its types, for **TypeScript** users):
318
318
319
319
```bash
320
-
$ npm install --save @hapi/joi
321
-
$ npm install --save-dev @types/hapi__joi
320
+
$ npm install --save joi
321
+
$ npm install --save-dev @types/joi
322
322
```
323
323
324
-
> warning **Notice** The latest version of `@hapi/joi` requires you to be running Node v12 or later. For older versions of node, please install `v16.1.8`. This is mainly after the release of `v17.0.2` which causes errors during build time. For more information, please refer to [their documentation](https://hapi.dev/family/joi/?v=17.0.2#install) & this [github issue](https://github.com/hapijs/joi/issues/2266#issuecomment-571667769).
324
+
> warning **Notice** The latest version of `joi` requires you to be running Node v12 or later. For older versions of node, please install `v16.1.8`. This is mainly after the release of `v17.0.2` which causes errors during build time. For more information, please refer to [their documentation](https://hapi.dev/family/joi/?v=17.0.2#install) & this [github issue](https://github.com/hapijs/joi/issues/2266#issuecomment-571667769).
325
325
326
326
Now we can define a Joi validation schema and pass it via the `validationSchema` property of the `forRoot()` method's options object, as shown below:
327
327
328
328
```typescript
329
329
@@filename(app.module)
330
-
import*asJoifrom'@hapi/joi';
330
+
import*asJoifrom'joi';
331
331
332
332
@Module({
333
333
imports: [
@@ -350,7 +350,7 @@ By default, unknown environment variables (environment variables whose keys are
0 commit comments