Fork me on GitHub

I wrote an article about ClojureScript form validation using spec: This article is also a solution for Clojure backend API to respond with human readable errors. --- I encourage to try my library for ClojureScript form validation using spec Here is a demo --- Please give me feedback if you like / dislike it and what I can do better for you.

🙌 11
👍 3
👏 1

Interesting approach. This requires you to write your specs always using a s/def, correct? i.e., you cannot use inline functions in an s/and


yes, because you use this (s/def ::email ...) keyword to determine what invalidated the map


another approach is to assign to each input field spec definition seprately instead of using ::form

(-> {:names->value {:email ""
                    :password ""}
     :form-spec ::form
     :names->validators {:email [email-exist?]
                         :password-repeat [password-repeat? ::spec-key]}}
In library which I made you can use one global spec, which is the whole form and you can additionally define spec for each map key {:password-repeat [password-repeat? ::spec-key]} So here you can set ::spec-key additionaly besides of ::form.


combining 1 spec for whole form and let add additional fn / specs for each form input seems to be fully functional for all you can need


i have used a similar approach in my own projects, nice article!


Using :via as a an error code seems nice. Slight conflation perhaps but quite handy. Here's a quick hack in a prototype I wrote recently, great to see others doing similar things.

(defn problems
  [spec data]
  (for [{:keys [path via val]} (::s/problems (s/explain-data spec data))
        :when (seq path)]
    {:path path :code (last via) :val val}))


For those interested, we do something similar in It lets you dispatch on anything in the explain-data problem rather than just the path.


Quick post about deploying CojureScript to a webserver 🎉

👀 2

This week on we are talking to @roman.bataev about Joker - Small #clojure interpreter and linter

🎉 6
👍 7

First public release. Helpful if you come from go-lang and want to try clojure, or if you work on Windows:

🎉 3

Interesting! The README is solid 👏 One suggestion: in addition to the What is this? section, it’d be helpful if there was also a Why is this? section — i.e. Rationale. Just my 2¢

💯 1

Thank you for your feedback. 😃 The Why? section existed, but eventually transformed to Is it only for Windows? section, and ease of installation/update that golang offered, the Usage section.


My pleasure. Ah I see, yeah it’s always interesting how docs evolve. You might want to bring back the rationale section. Now that those other sections exist, it can be short and sweet.


Rewrote the parser configuration options for edamame, a configurable EDN parser which attaches location metadata to values. Examples: API docs: 100% backwards compatible with the previous options, which have now become undocumented.

👍 2