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

Why Conditional Validation ignored all constraint on a field instead? #318

Open
ahmadtofeeq opened this issue Feb 19, 2019 · 4 comments · May be fixed by #2244
Open

Why Conditional Validation ignored all constraint on a field instead? #318

ahmadtofeeq opened this issue Feb 19, 2019 · 4 comments · May be fixed by #2244
Labels
type: question Questions about the usage of the library.

Comments

@ahmadtofeeq
Copy link

ahmadtofeeq commented Feb 19, 2019

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?

@AndKiel
Copy link

AndKiel commented Feb 19, 2019

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.

@lucasmonstrox
Copy link

News?

@LendaVadym
Copy link

The same problem, we need some approach to separately enable/disable decorators.

@juansb827
Copy link

still an issue 😢

@NoNameProvided NoNameProvided added the type: question Questions about the usage of the library. label Dec 9, 2022
@mario-orlicky mario-orlicky linked a pull request Sep 16, 2023 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Questions about the usage of the library.
Development

Successfully merging a pull request may close this issue.

6 participants