Skip to content

Custom validation not working with async #1333

Answered by thetutlage
popovicieduard asked this question in Help
Discussion options

You must be logged in to vote

You have to tell the validator in advance, that you are going to create an async validation by defining a third argument.

async function validate () {}

async function compile () {
  return {
    async: true,
  }
}

validator.rule('checkUniqueAccountEmail', validate, compile)

Check the AdonisJS unique rule https://github.com/adonisjs/lucid/blob/develop/src/Bindings/Validator.ts#L188

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@zmaglica
Comment options

@popovicieduard
Comment options

Answer selected by popovicieduard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants