-
Notifications
You must be signed in to change notification settings - Fork 827
Open
Labels
flag: needs discussionIssues which needs discussion before implementation.Issues which needs discussion before implementation.type: featureIssues related to new features.Issues related to new features.
Description
Description
like this
#740
export class ContentSave {
@IsDefined()
@MinLength(5)
title: string;
@Type()
submit?: boolean;
}
when submit is true, i want to skip IsDefined , but not minLength
for example:
{title: "111111111", submit: true} => valid
{title: undefined, submit: false} => valid
{title: "1", submit: false} => invalid(MinLength)
Proposed solution
add skipIf
on the ValidationOptions
export class ContentSave {
@IsDefined({
skipIf: (data) => data.submit !== true
})
@MinLength(5)
title: string;
@Type()
submit?: boolean;
}
Metadata
Metadata
Assignees
Labels
flag: needs discussionIssues which needs discussion before implementation.Issues which needs discussion before implementation.type: featureIssues related to new features.Issues related to new features.