I’m trying to develop a generic data validation engine for web forms. Basically, the idea is to write a library that loads a JSON “validation schema”, and then generates the appropriate server-side and client-side validation rules for various data validation libraries.
It seems like everyone has their own set of validation rule names. For example, suppose you need to check that a string has a minimum number of characters. In the server-side library Valitron, the rule is called lengthMin
. In the client-side library bootstrapvalidator, it’s called stringLength
.
My question is, is there any kind of standard out there (ANSI, ISO, etc) for the rule names and parameter names of common data validation rules?
2
There are no standards for naming conventions by any major working group. The closest you might get would be standards within an organisation or for a particular product so you are effectively free to choose the names that you feel are best.
Maybe pick the best of some already great implementations (e.g. ActiveRecord Validations / Flask WTF etc.). You can’t go wrong borrowing from them.