Skip to content

Commit

Permalink
docs: update JSDoc for forbidUnknownValues
Browse files Browse the repository at this point in the history
  • Loading branch information
NoNameProvided committed Dec 2, 2022
1 parent 3976453 commit e252183
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/validation/ValidatorOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ export interface ValidatorOptions {
};

/**
* Settings true will cause fail validation of unknown objects.
* Fails validation for objects unknown to class-validator. Defaults to false.
*
* For instance, since a plain empty object has no annotations used for validation:
* - `validate({})` // passes
* - `validate({}, { forbidUnknownValues: true })` // fails.
* - `validate(new SomeAnnotatedEmptyClass(), { forbidUnknownValues: true })` // passes.
*/
forbidUnknownValues?: boolean;

Expand Down

0 comments on commit e252183

Please sign in to comment.