This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-27
Channels
- # beginners (54)
- # bitcoin (2)
- # boot (1)
- # calva (10)
- # cider (30)
- # cljs-dev (25)
- # cljsrn (17)
- # clojure (27)
- # clojure-dev (16)
- # clojure-estonia (3)
- # clojure-hk (1)
- # clojure-italy (8)
- # clojure-losangeles (1)
- # clojure-nl (17)
- # clojure-russia (1)
- # clojure-spec (15)
- # clojure-uk (45)
- # clojurebridge (1)
- # clojurescript (95)
- # clojurescript-ios (1)
- # core-async (5)
- # cursive (10)
- # datomic (8)
- # emacs (2)
- # figwheel-main (31)
- # fulcro (99)
- # hyperfiddle (3)
- # immutant (1)
- # jobs (13)
- # jobs-discuss (82)
- # keechma (6)
- # leiningen (3)
- # lumo (1)
- # nrepl (1)
- # off-topic (37)
- # onyx (1)
- # pedestal (6)
- # re-frame (7)
- # reitit (2)
- # remote-jobs (1)
- # ring-swagger (3)
- # rum (6)
- # shadow-cljs (14)
- # specter (4)
- # tools-deps (27)
- # yada (12)
You're only reading the last part of the failure -- the first part says "2018-09-26T21:47:57.304Z" fails spec: :io.cloudrepo.signup.email/creation-timestamp
So you have an ::email/creation-timestamp
spec and that string fails to conform to it.
Since that fails, the whole :success
part fails and the the whole hashmap fails the :not-found
part -- the val
in explain is the whole hash map, not just the creation timestamp string.
s/keys
will conform/validate any keys that are provided that have a corresponding spec, not just the listed :req
keys.
but I guess that's good because it will catch where you create bad data at the first possible point
Yup. The assumption is that specs should apply wherever those uniquely-name keys appear.
If you're using unqualified keys, you won't run into that -- since only the :req-un
and :opt-un
keys will map to specs.
I have this spec:
(spec/cat :op #{:jdbc/insert}
:table keyword?
:row map?)
for a data structure like [:jdbc/insert :foo {:bar "baz"}]
. how would I add an optional 4th element at the end?:options (s/? ::opt-spec)
(assuming you wanted to optionally pass in an options map of some sort @lilactown)