📎 Add minor improvement on notification message validation

This commit is contained in:
Andrey Antukh 2024-07-22 13:11:49 +02:00
parent 9e0fb44b3f
commit 7e50ab52b9

View file

@ -17,9 +17,7 @@
(def default-timeout 7000)
(def ^:private
schema:message
(sm/define
(def ^:private schema:message
[:map {:title "Message"}
[:type [::sm/one-of #{:success :error :info :warning}]]
[:status {:optional true}
@ -43,13 +41,16 @@
[:vector
[:map
[:label :string]
[:callback ::sm/fn]]]]]))
[:callback ::sm/fn]]]]])
(def ^:private valid-message?
(sm/validator schema:message))
(defn show
[data]
(dm/assert!
"expected valid message map"
(sm/check! schema:message data))
(valid-message? data))
(ptk/reify ::show
ptk/UpdateEvent