Skip to content

Performing sequential and asynchronous custom validation #2528

Open
@PerceptControl

Description

@PerceptControl

I stuck in situation where I need to do serial db queries on validation stage. For example:

{
   Validate(aExistInDb)
   fieldA: string
   
   Validate(bExistInDb)
   fieldB: string
}

Let's assume validators "aExistInDb" and "bExistInDb" both are async and execute some select queries from db

In my situation field b relates on a. It means that I want to check fieldB only when I sure that "a" field exist and correct.
I expected that "bExistInDb" validation will run only when "aExistInDb" ends. But now both starts immediately.

What shall I do then?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questionQuestions about the usage of the library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions