From b1aafb3c00463bbb1129c67d4e519e74c93b1b9a Mon Sep 17 00:00:00 2001 From: Andreas Billmann Date: Fri, 18 Dec 2015 16:27:51 +0100 Subject: [PATCH] Updated Validation Configuration (markdown) --- Validation-Configuration.md | 50 ++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/Validation-Configuration.md b/Validation-Configuration.md index 1fc22cf..658aa1a 100644 --- a/Validation-Configuration.md +++ b/Validation-Configuration.md @@ -107,4 +107,52 @@ _(Empty cells are not checked, see not empty validation)_ "groovy" : "value.contains('9') ? true : 'SOME ERROR TEXT'" If the regexp is not enough, the groovy validation should fit. The groovy expressions can use the variable value which is the String in the cell. It should return a boolean true or the String "true" to be valid, in all other cases the toString representation of the result will be the error message. That also means, that there is no i18n support for the message! -_(Empty cells are not checked, see not empty validation)_ \ No newline at end of file +_(Empty cells are not checked, see not empty validation)_ + +## Full Example + { + "headers" : { + "list": ["COLUMN WITH EXACTLY 4 DIGITS","COLUMN MAYBE EMPTY OR 1 OR 0","COLUMN MAYBE EMPTY OR DOUBLE","UNCHECKED COLUMN","NOT EMPTY AND ONE OF THE COLORS","AN INTEGER AND NOT EMPTY","SOME MANDATORY DATE","OPTIONAL DATE","EMPTY OR STRING STARTS WIDTH ID MINUS"] + }, + + "columns" : { + "COLUMN WITH EXACTLY 4 DIGITS": { + "integer" : true, + "not empty" : true, + "maxlength" : 4, + "minlength" : 4 + }, + + "COLUMN MAYBE EMPTY OR 1 OR 0": { + "value of" : ["0", "1"] + }, + + "COLUMN MAYBE EMPTY OR DOUBLE": { + "double" : true + }, + + "NOT EMPTY AND ONE OF THE COLORS" : { + "not empty" : true, + "value of" : ["red","green","blue"] + }, + + "AN INTEGER AND NOT EMPTY" : { + "not empty" : true, + "integer" : true + }, + + "SOME MANDATORY DATE": { + "date" : "yyyyMMdd", + "not empty" : true + }, + + "OPTIONAL DATE": { + "date" : "yyyyMMdd" + }, + + "EMPTY OR STRING STARTS WIDTH ID MINUS" : { + "groovy" : "value.startsWith('ID-') ? true : 'NOT A CORRECT ID'" + } + } + + } \ No newline at end of file