Closed
Description
Description
This issue us copied and modified from PR #635 by @ytetsuro,
Currently, the @IsNotEmptyObject
decorator allows objects with null values only. I would like an option for the @IsNotEmptyObject
decorator to fail validation when all object property is null
or undefined
.
Proposed solution
Minimal example of proposed feature:
class MyClass {
@IsNotEmptyObject()
notStrictModeInvalid = { }; // invalid
@IsNotEmptyObject()
notStrictModeValid = { key1: null, key2: undefined }; // valid
@IsNotEmptyObject({ nullable: false })
strcitModeInvalid = { }; // invalid
@IsNotEmptyObject({ nullable: false })
strcitModeValid = { key1: null, key2: undefined }; // invalid
@IsNotEmptyObject({ nullable: false })
strcitModeValid = { key1: 'key', key2: undefined }; // valid
}