src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt

changeset 227
f0ede8046b59
parent 225
87328572e36f
child 254
55ca6cafc3dd
--- a/src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt	Wed Aug 18 15:04:59 2021 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt	Wed Aug 18 15:30:49 2021 +0200
@@ -304,4 +304,12 @@
     }
 }
 
+fun boolValidator(input: String?): ValidationResult<Boolean> {
+    return if (input.isNullOrBlank()) {
+        ValidatedValue(false)
+    } else {
+        ValidatedValue(!(input.equals("false", true) || input == "0"))
+    }
+}
+
 // </editor-fold>

mercurial