General data record validation

Has anyone made anything approximating a general data record property validator?

It's easy enough to create one-off components to do validation of a few specific properties, but as the property list gets longer and the rules get a little more convoluted, it's a bit of a hassle. So, I was trying to come up with a good model so I could specify property names and associated validation rules. I'd like to at least be able to answer these kinds of questions of a property:


  • It is defined and has a non-zero string length
  • It is numeric
  • It has a numeric value between X and Y
  • It is required only if another property is present
  • Its value matches a regular expression


Does anyone have any ideas for modeling these rules in a component parameter?

I was thinking of something like this, in a TextType parameter:


PropertyA;required PropertyB;requiredif;PropertyA is defined and isnumber(PropertyA) PropertyC;regex;^[A-P]\d{2}\$



It's not pretty, but it's relatively concise, and I'd have some backing script in a custom manipulator to do the dirty work. I'm open to better suggestions! I just think I need a better way to enforce that all properties are in a valid state in my protocols.