We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I'm getting this error on a number field on my class:
Some model class...
@IsIn([ Difficulties.EASY, Difficulties.MEDIUM, Difficulties.DIFFICULT ]) public difficulty:number;
export class Difficulties { static EASY:number=0; static MEDIUM:number=1; static DIFFICULT:number=2; };
According to this post looks like the validator.js library doesn't work anymore with fields that are not STRING: validatorjs/validator.js#505
Thanks, F.
The text was updated successfully, but these errors were encountered:
I am facing similar problem as @fabiobeoni
Sorry, something went wrong.
Hi @fabiobeoni!
I am going to close this as I cannot reproduce this issue with the current release.
import { IsIn, validate } from 'class-validator'; export class Difficulties { static EASY: number = 0; static MEDIUM: number = 1; static DIFFICULT: number = 2; }; export class TestClass { @IsIn([ Difficulties.EASY, Difficulties.MEDIUM, Difficulties.DIFFICULT ]) public difficulty: number; } const instance = new TestClass() instance.difficulty = 9 validate(instance).then(console.log);
This will return with the correct error:
difficulty must be one of the following values: 0,1,2
No branches or pull requests
Hello,
I'm getting this error on a number field on my class:
Some model class...
According to this post looks like the validator.js library doesn't work anymore with fields that are not STRING: validatorjs/validator.js#505
Thanks, F.
The text was updated successfully, but these errors were encountered: