ManifestM
Manifestโ€ข8mo ago
mirthis

Custom validation and abort main endpoint execution

Hello,
Is there a build in feature to create custom validators?

I need to validate a field is unique and I don't see this in the list of existing validators.
I created a middleware to run on beforeCreate and I'm able to run my logic there and return the appropriate response.

Still unless I throw an error in the middleware the endpoint logic (in this case insert) is still executed.

What is the best approach to do this?
Was this page helpful?