whefter / nestjs-joi

Easy to use JoiPipe as an interface between joi and NestJS with optional decorator-based schema construction.
MIT License
25 stars 12 forks source link

Allow unknown false for all fields #8

Closed erald14 closed 3 years ago

erald14 commented 3 years ago

IS there any to do @JoiSchemaOptions({ allowUnknown: false, }) for every class without having to append it to every class

whefter commented 3 years ago

I've been meaning to implement something that should help with this for a while, take a look at the new defaultValidationOptions option for JoiPipe in v1.5.1: https://github.com/whefter/nestjs-joi#pipe-options-pipeopts

(Don't forget it can be injected when using JoiPipeModule).

Going beyond this would require setting global options on the module instance object itself, which is not something I like to do. Let me know if this helps you out.