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?
1 Reply
brunobuddy
brunobuddy5mo ago
Hello @mirthis, validating uniqueness can be really important in some use cases. As of today Manifest does not have this feature yet but I added it to the public backlog. You can upvote it to give it some highlight => https://github.com/mnfst/manifest/discussions/412 I personnaly think that this is an important feature that can be integrated soon
GitHub
Unique validator · mnfst manifest · Discussion #412
A validator assuring the uniqueness of a property, meaning that there is not other item in that collection that has this value for a property

Did you find this page helpful?