From 84f76a4839ac888fbaf3199bb652e33f744a3aeb Mon Sep 17 00:00:00 2001 From: Andreas Billmann Date: Fri, 18 Dec 2015 15:14:50 +0100 Subject: [PATCH] Created Validation Configuration (markdown) --- Validation-Configuration.md | 106 ++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 Validation-Configuration.md diff --git a/Validation-Configuration.md b/Validation-Configuration.md new file mode 100644 index 0000000..adb8a6b --- /dev/null +++ b/Validation-Configuration.md @@ -0,0 +1,106 @@ +# Validation Configuration +The configuration file for validations is written in JSON. Each file has two sections. + + { + "headers" : { + ... + }, + + "columns" : { + ... + } + } + +## header section +In the header section a list of headers are defined. The CSV file should have the same headers in the same order. Otherwise the validation fails. + + "headers" : { + "list": ["COLUMN 1","COLUMN 2","NAME","SOME OTHER COLUMN"] + } + + +## column section +In the column section, each column that should be validated, should have an entry. Columns without the need of validation can be omitted. Each column can have multiple validations and each of them is checked. + + "columns" : { + "COLUMN 1": { + "integer" : true, + "not empty" : true, + "maxlength" : 4, + "minlength" : 4 + }, + + "COLUMN 2": { + "value of" : ["0", "1"] + }, + + "SOME OTHER COLUMN": { + "double" : true + } + } + +## Available Validations +### not empty + + "not empty" : true + +The cell could not be empty. Otherwise a cell can be empty or has to be valid in combination of the other validations. If an empty cell is not allowed, this validations has to be set! + +### integer + + "integer" : true + +The value of the cell has to be an Integer based on java.lang.Integer. +_(Empty cells are not checked, see not empty validation)_ + +### double + + "double" : true + +The value of the cell has to be an Double based on java.lang.Double. +_(Empty cells are not checked, see not empty validation)_ + +### minlength + + "minlength" : 4 + +The cell must have at least the given number of characters, in the above example a number of 4. +_(Empty cells are not checked, see not empty validation)_ + +### maxlength + + "maxlength" : 4 + +The cell should not have more than the given number of characters, in the above example a number of 4. +_(Empty cells are not checked, see not empty validation)_ + +### value of + + "value of" : ["0", "1", "TWO", "SOME OTHER VALUE"] + +The value must be one of the values defined in a list of strings. +_(Empty cells are not checked, see not empty validation)_ + +### date + + "date" : "yyyyMMdd" + +The value has to be a date in the given format. The format is defined for java.text.SimpleDateFormat, check the official documentation of this java class for further information. +_(Empty cells are not checked, see not empty validation)_ + +### alphanumeric + + "alphanumeric" : true + +The value can only be numerics and alphabetic characters. +_(Empty cells are not checked, see not empty validation)_ + +### regexp + + "regexp" : "[0-9a-zA-Z]*" + +To support more complex validations, the cell can be matched against a regular expression. +_(Empty cells are not checked, see not empty validation)_ + +### groovy +