class-validator
class-validator copied to clipboard
question: Why `@IsInt` did not validate the number to be in range
I was trying to validate incoming number to be a valid integer but It was not. As you can see here in Prisma repo this kind of bugs in a widely used validator like class-validator can cause serious issues for apps which are in prod env. please do something for it or create new decorators to validate Int64 and Int32.
The problem and temporary solution:
import { IsInt, Max } from 'class-validator';
export class ClassName {
@IsInt() // I expected that this decorator do the following decorator too.
@Max(2_147_483_647) // maximum valid Int32 number
fieldNameWichIsInt: number;
}