Skip to content
New issue

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

fix: @IsIn() returns false positive true if not an Array instance was passed #1693

Open
ghost opened this issue Jul 11, 2022 · 1 comment
Open
Labels
status: fixed Issues with merged PRs, but not released yet. type: fix Issues describing a broken feature.

Comments

@ghost
Copy link

ghost commented Jul 11, 2022

Description

@IsIn() decorator always return true, if not an Array instance was passed as possibleValues argument.

Minimal code-snippet showcasing the problem

import { isIn } from 'class-validator';

const value = 'ABC';

console.log(isIn(value, [value]));   // Expected true, received true
console.log(isIn(value, 5));         // Expected false, received true
console.log(isIn(value, 'ABC'));     // Expected false, received true
console.log(isIn(value, false));     // Expected false, received true

Expected behavior

@IsIn() should not return false positive result if it can't validate given value.

Actual behavior

@IsIn() returns false positive result if not an Array instance was passed.

@ghost ghost added status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. labels Jul 11, 2022
@NoNameProvided
Copy link
Member

Thanks. This is fixed in #1844.

@NoNameProvided NoNameProvided added status: fixed Issues with merged PRs, but not released yet. and removed status: needs triage Issues which needs to be reproduced to be verified report. labels Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: fixed Issues with merged PRs, but not released yet. type: fix Issues describing a broken feature.
Development

No branches or pull requests

1 participant