This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-14
Channels
- # beginners (4)
- # boot (78)
- # braveandtrue (3)
- # cider (9)
- # clara (6)
- # cljs-dev (4)
- # clojure (57)
- # clojure-brasil (1)
- # clojure-russia (99)
- # clojure-spec (20)
- # clojure-uk (40)
- # clojurescript (162)
- # component (17)
- # cursive (4)
- # datomic (21)
- # docker (2)
- # emacs (5)
- # figwheel (2)
- # hoplon (363)
- # jobs (1)
- # leiningen (1)
- # om (4)
- # om-next (5)
- # onyx (10)
- # proton (1)
- # re-frame (13)
- # reagent (13)
- # ring (3)
- # rum (1)
- # slack-help (1)
- # test-check (3)
- # untangled (7)
- # vim (24)
so let's say I am enriching a data structure with chained transformations (`map`-ing or specter
-ing)...and I want to spec every substep. For instance the first step has {:family {:name "bla"}}
the second step will have {:family {:name "bla" :id :sda}}
.
how can I spec the second step after having already spec-ed the first as:
(s/def :family/entity (s/keys :req-un [:family/name]))
(s/def :family/family :family/entity)
(s/def :root/entity (s/keys :req-un [:family/family]))
now it should be ok
so basically I'd need to add another spec adding :family/id
but I can't see how to do it without overriding the :family/family
spec
ok I could change the namespace probably
Can you s/merge
the :family/family
spec with a new one which only specifies the new element?
maybe š let me try that
but then I still need to change the namespace in the register
You could eval
the s/def
with a modified nameā¦although having been doing a lot of it, Iāll warn you that thatās a route that can get reeeaaally sticky pretty fast. & there seem to be issues with eval
ing s/merge
(thatās where I stopped today, had to call a halt. In fact, crap, what am I doing here? Going AFK immediately š )
it works, but now for each transformation I need:
(s/def :entity-with-id/family (s/merge :family/entity (s/keys :req-un [:family/id])))
(s/def :entity-with-id/definitions (s/keys :req-un [:entity-with-id/family]))
so the namespace becomes the name of the transformation I want to target
hey all. is there a handy spec i can use for things that can be passed to s/valid?
for testing?
aren't specs just either of the first two?
also thinking aloud: i kinda want a predicate that is basically any?
but means ānot yet specād"
@bbloom (def not-specd-yet? any?)