Reputation: 3452
I have a field in my class that looks like so:
@IsDefined()
@IsInt()
@Min(1)
@Max(10)
someNumber: number;
I'd like someNumber
to also be able to be assigned -1
. How can I incorporate this without making a custom validator?
Upvotes: 1
Views: 1474
Reputation: 14257
You could combine the NotEquals
with the Min
decorator:
@IsDefined()
@IsInt()
@NotEquals(0)
@Min(-1)
@Max(10)
someNumber: number;
Upvotes: 2