From 0db1eed87f759acbe02bc28845a256742995ac48 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 16 Aug 2024 12:04:18 +0200 Subject: [PATCH] :sparkles: Improve word-string schema generator make it to generate a more readable strings --- common/src/app/common/schema/generators.cljc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/common/src/app/common/schema/generators.cljc b/common/src/app/common/schema/generators.cljc index 081e1d5ca8..38d16b995e 100644 --- a/common/src/app/common/schema/generators.cljc +++ b/common/src/app/common/schema/generators.cljc @@ -77,14 +77,11 @@ (defn word-string [] - (as-> tg/string-alphanumeric $$ - (tg/such-that (fn [v] (re-matches #"\w+" v)) $$ 50) - (tg/such-that (fn [v] - (and (not (str/blank? v)) - (not (re-matches #"^\d+.*" v)))) - $$ - 50))) - + (as-> tg/string-ascii $$ + (tg/resize 10 $$) + (tg/fmap (fn [v] (apply str (re-seq #"[A-Za-z]+" v))) $$) + (tg/such-that (fn [v] (>= (count v) 4)) $$ 100) + (tg/fmap str/lower $$))) (defn email []