This commit is contained in:
jem 2021-03-19 14:43:37 +01:00
parent 7a6f31b96a
commit 86d001c2ce

View file

@ -1,6 +1,5 @@
(ns dda.k8s-mastodon-bot.browser (ns dda.k8s-mastodon-bot.browser
(:require (:require
[clojure.string :as st]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.reader.edn :as edn] [clojure.tools.reader.edn :as edn]
[expound.alpha :as expound] [expound.alpha :as expound]
@ -41,14 +40,6 @@
(.-value) (.-value)
(set! input))) (set! input)))
(defn validate-config! []
(let [config (config-from-document)]
(when-not (s/valid? ::core/config config)
(-> config
(edn/read-string)
#(expound/expound-str ::core/config % {:print-specs? false})
(render-validation-result-to-config)))))
(defn render-validation-result-to-config (defn render-validation-result-to-config
[validation-result] [validation-result]
(print-debug validation-result) (print-debug validation-result)
@ -60,6 +51,17 @@
(.add "was-validated")) (.add "was-validated"))
validation-result) validation-result)
(defn expound-config [config]
(expound/expound-str ::core/config config {:print-specs? false}))
(defn validate-config! []
(let [config (config-from-document)]
(when-not (s/valid? ::core/config config)
(-> config
(edn/read-string)
(expound-config)
(render-validation-result-to-config)))))
(defn init [] (defn init []
(-> js/document (-> js/document
(.getElementById "generate-button") (.getElementById "generate-button")