You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create multi purpose model using conditional validation. Look at the below model -
class TestModel extends Model {
public isCreated: boolean | undefined;
@IsUUID()
@ValidateIf(o => o.isCreated === true)
@IsNotEmpty()
public id: string | undefined;
}
i want that if isCreated is false then id must behave as optional parameter. and IsUUID() constraint should not be ignored. ValidateIf ignore both constraint. Any Idea?
The text was updated successfully, but these errors were encountered:
Looks like the order of things doesn't matter, it can be IsUUID/ValidateIf/IsNotEmpty or IsNotEmpty/IsUUID/ValidateIf and so on... :/ I've got a similar problem. I've got multiple validations on a property and want to run one, then the rest if that first one passes. So far no luck.
I am trying to create multi purpose model using conditional validation. Look at the below model -
i want that if isCreated is false then id must behave as optional parameter. and IsUUID() constraint should not be ignored. ValidateIf ignore both constraint. Any Idea?
The text was updated successfully, but these errors were encountered: