In my previous post about relating different data constructs in AngularJS to each other via property names, I mentioned that I figured out that technique while working on an internal development tool. This blog post is about that tool.
The AngularJS-powered validORM tool lets you design the ID and column properties of your ColdFusion/CFML ORM CFCs while at the same time creating a matching set of validation rules using the ValidateThis (VT) library (a great library for handling both client and server-side validation).
The first view of the tool is a menu view. You can choose to generate an updated version of your CFC and VT rules file based on a previous session or create a new set of files from scratch. Either choice takes you to the generator view.
The first two sections of the in the generator view are pretty obvious: that's where you choose the name and database table for your ORM object and configue the ID property.
The last two sections allow you to further define any ValidateThis conditions and contexts referenced in your column property rules. When you're done, clicking the submission button will trigger the file generation process. Your ORM and VT configuration data will be parsed by a CFC which will then generate three files in the output folder of the tool:
- An ORM CFC written in script format.
- A ValidateThis rules definition file matching that CFC written in JSON format.
- A JSON-formatted snapshot of the configuration data, with a filename reflecting the name of the object and the timestamp when the file was generated. Said file will then appear in the menu view of the tool.
Some caveats: the tool only allows for one ID property, doesn't include absolutely every type of property attribute (just the majority of them), and it doesn't let you define ORM relationship properties. And as my first foray with using AngularJS, I'm sure it violates one or two Angular best practices (if you're an Angular guru, feel free to chime in with any suggestions for improvement).
But it works and can provide a kickstart to creating any ORM files and ValidateThis rules for your projects. It comes with an example "Employee" configuration set that you can play with and then delete once you start using the tool.
The tool is available for download (and modification) via GitHub: https://github.com/bcswartz/validORM. I also created a short video of the tool in action and posted it on YouTube at: http://www.youtube.com/watch?v=-fnt_n65NWg