From e757c1b2d9edf46696ca0a99431830e26b849600 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 5 Oct 2020 18:19:23 +0200 Subject: [PATCH] :bug: Fix uuid and keyword base specs. --- common/app/common/spec.cljc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/common/app/common/spec.cljc b/common/app/common/spec.cljc index 4b58b561a5..e9d81eae14 100644 --- a/common/app/common/spec.cljc +++ b/common/app/common/spec.cljc @@ -38,7 +38,7 @@ (if (string? v) (if (re-matches uuid-rx v) (uuid/uuid v) - (if (str/empty? v) nil ::s/invalid)) + ::s/invalid) ::s/invalid))) (defn boolean-conformer @@ -87,9 +87,21 @@ v ::s/invalid)) +(defn keyword-conformer + [v] + (cond + (keyword? v) + v + + (string? v) + (keyword v) + + :else + ::s/invalid)) + ;; --- Default Specs -(s/def ::keyword keyword?) +(s/def ::keyword (s/conformer keyword-conformer name)) (s/def ::inst inst?) (s/def ::string string?) (s/def ::email (s/conformer email-conformer str))