We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
forbidUnknownValues
1 parent 3976453 commit e252183Copy full SHA for e252183
src/validation/ValidatorOptions.ts
@@ -72,7 +72,12 @@ export interface ValidatorOptions {
72
};
73
74
/**
75
- * Settings true will cause fail validation of unknown objects.
+ * 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.
81
*/
82
forbidUnknownValues?: boolean;
83
0 commit comments