This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-06
Channels
- # bangalore-clj (16)
- # beginners (120)
- # boot (21)
- # cider (24)
- # clara (9)
- # cljs-experience (1)
- # cljsrn (1)
- # clojure (218)
- # clojure-dev (3)
- # clojure-italy (12)
- # clojure-losangeles (4)
- # clojure-norway (2)
- # clojure-russia (2)
- # clojure-spec (19)
- # clojure-uk (178)
- # clojurescript (52)
- # cursive (7)
- # data-science (55)
- # datomic (25)
- # defnpodcast (11)
- # emacs (5)
- # fulcro (27)
- # hoplon (2)
- # leiningen (14)
- # midje (9)
- # off-topic (132)
- # onyx (19)
- # other-languages (23)
- # portkey (2)
- # re-frame (31)
- # reagent (1)
- # ring-swagger (15)
- # shadow-cljs (58)
- # slack-help (13)
- # spacemacs (22)
- # sql (7)
- # test-check (13)
@drewverlee I think the human error messages also need to include a location which is separate from their spec position. Sometimes you need to do validation across keys for humans, but place the error message on a particular key (password & password_confirm must match, but if they don't, the error is in password_confirm)
i find them noisy and like that test.chuck turns them off when using the checking
macro
Is there a rational for the :reason
key in the problem map produced by spec/explain-data?
. I cant find any discussion on it
is there a function that you can call on a spec to get the code for the spec?
(s/data some-spec)
;;=> (s/def ::some-spec string?)
https://clojure.github.io/clojure/branch-master/clojure.spec-api.html#clojure.spec/form
(s/form some-spec)
in your example should work @drewverlee
It seems to only return part of the spec.
(s/def ::kid (s/keys ::req [::name]))
(s/form ::kid)
;;> (spec/keys)
good catch
Hmm, how about something similar for spec functions? those defined using fdef?
How does that work? backtick stops evaluation of things and qualifies their namespace. Why does that help?
> However, symbols used within a syntax quote are fully resolved with respect to the current namespace
(defn foo [x] x)
=> #'sandbox.core/foo
foo
=> #object[sandbox.core$foo 0x111da369 "sandbox.core$foo@111da369"]
`foo
=> sandbox.core/foo
(type foo)
=> sandbox.core$foo
(type `foo)
=> clojure.lang.Symbol
gotcha. I was actual experiencing another mis understanding the same time concerning lists.