Some time back, I posted a series of blog entries regarding data validation, seeking input on how developers approached the issue. I felt at the time, and still do, that data validation is not something that should have to be rewritten from scratch for each new application. Sure, validation rules are different, but the core concept of data validation is no different.After trying to grab every bit of free time over the last couple of months, I would like to introduce Validat, an open source data validation engine for ColdFusion. The code is currently available and marked as Alpha until I can get some more documentation written (the bane of every open source project!). Once the initial pass at the documentation is complete, we already have a refactoring planned, but I want to get your input and feedback. So, take a look when you have a spare moment and let us know what you like and don’t like.
Where do I find more information?
A Trac site has been setup for the project at http://trac.alagad.com/Validat and this site contains the information currently available about Validat and will continue to be added to over the coming days and weeks.To get the source for Validat, an anonymous SVN repository is available at http://svn.alagad.com/Validat. The main trunk is all there is at the moment. We will start adding tags as development progresses and the code gets tighter.To ask any questions or provide feedback, a Google Group site has been setup as well at http://groups.google.com/group/Validat. Please sign up and fire away with your questions or comments.
An Overview of Validat
Validat is a data validation engine that is broken up into 3 parts … a collection of pluggable validators, one or more data transformers and one or more data set configurations.The validators allow you to build your own custom validation rules. This could be as simple as checking that a given data field (element) contains a value or as complex as running tests based upon multiple data fields, talking to a database or web service, etc. The idea is that no validation framework can imagine every possible test, so this allows you to easily add your own validation routines.The data transformers abstract out the concept of where the data being validated is coming from. This way, we can have a simple form structure transformer that knows to retrieve data out of the form scope and send it to the validation engine. We also have a basic bean transformer that inspects a bean and grabs its data based upon each getter method. The goal here again is abstracting out where the data is coming from so if you prefer to validate beans vs. form data, you can do whatever you wish.The last piece to the puzzle is the data set configuration. Basically what this is is a mapping between data elements and validation rules. For example, the firstName data element requires the "required" valdiator to be run. Through this mapping your can also setup mappings between groups of fields – for example a validation rule for the firstName, lastName, and emailAddress data elements to determine if they represent a unique user. This mapping can be setup via an XML configuration or via a programmatic API if you want to store and manage the rules via your application (a dynamically built form for example).More information is to come via the Trac site and again, in the mean time, feel free to post a question or comment in the Validat Google Groups site.