Skip to content

Commit e252183

Browse files
docs: update JSDoc for forbidUnknownValues
1 parent 3976453 commit e252183

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/validation/ValidatorOptions.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ export interface ValidatorOptions {
7272
};
7373

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

0 commit comments

Comments
 (0)