Skip to content

Custom validator with arguments #3651

Answered by tomgobich
galaczi asked this question in Help
Discussion options

You must be logged in to vote

I'm a bit confused why you're not just using the notIn rule? It looks like you're pretty much just recreating it under a different name.

Also, it sounds like the below is the portion of the documentation you were looking for. It shows how to pass arguments into a custom validation rule and it shows how to use your custom rule's error properties to provide a custom message.
https://docs.adonisjs.com/guides/validator/custom-rules#passing-options-to-the-rule

You can also find more information about the error reporting system and what pointers are here:
https://docs.adonisjs.com/guides/validator/error-reporters#creating-your-error-reporter

The validation is passed if no errors are reported us…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

@tomgobich
Comment options

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