Skip to content

Commit eee6c92

Browse files
Suggest update in "Object schema validation"
The method validate(value) is accessible if the schema parameter is a ObjectSchema from @hapi/joi.
1 parent f5a2865 commit eee6c92

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

content/pipes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,11 @@ In the next section, you'll see how we supply the appropriate schema for a given
156156
```typescript
157157
@@filename()
158158
import { PipeTransform, Injectable, ArgumentMetadata, BadRequestException } from '@nestjs/common';
159+
import { ObjectSchema } from '@hapi/joi';
159160

160161
@Injectable()
161162
export class JoiValidationPipe implements PipeTransform {
162-
constructor(private schema: Object) {}
163+
constructor(private schema: ObjectSchema) {}
163164

164165
transform(value: any, metadata: ArgumentMetadata) {
165166
const { error } = this.schema.validate(value);

0 commit comments

Comments
 (0)