This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-06
Channels
- # alda (3)
- # beginners (109)
- # boot (24)
- # cljsrn (17)
- # clojure (41)
- # clojure-brasil (2)
- # clojure-china (1)
- # clojure-russia (19)
- # clojure-spec (9)
- # clojure-uk (5)
- # clojurescript (44)
- # cloverage (5)
- # core-async (3)
- # css (2)
- # datascript (6)
- # datomic (26)
- # emacs (2)
- # events (10)
- # hoplon (24)
- # lambdaisland (1)
- # om (2)
- # onyx (16)
- # other-languages (10)
- # proto-repl (2)
- # re-frame (14)
- # spacemacs (2)
- # untangled (4)
- # videos (1)
@lvh: I’ve been doing a spec for our datomic data, but I’m generating specs from our (somewhat customized) schema definition vectors, not from the datalog itself. In retrospect I might have derived them from the datalog in the interest of greater generality.
We have some custom code that takes things like:
[[:ti/install-type :ti/Location []
"A location in the real world that can be the source or destination of a shipment"
{:id [:uuid :identity "Unique ID for the location"]
:name [:string :fulltext "The name of the loaction"] ...]]
and turns them into vanilla datomic schema defs.Hi all, is there a way to use multi-spec with a multimethod that takes two arguments instead of one? I’d like to be able to dispatch on a key/value outside of the map being mult-spec’d. Another way of describing the problem is: I have some map of the shape:
{:message/uuid uuid
:message/action :some-action
:message/payload {}}
:message/payload
changes its shape based on :message/action.
As far as I can tell, multi-specs only allow you to dispatch on a key/value inside of the data structure. i.e. it would only be able to do the following:
{:message/uuid uuid
:message/payload
{:payload/action :some-action
;; other data here
}}
This is what I’m currently using, but I think it is more appropriate to place the :action as part of the message, and not the payload.@levitanong: consider the message as a whole -- although it has the same three keys in every case, the spec for :message/payload
would be different in each arm of the multi spec.
I started on a custom formatter for :cljs.spec/problems in cljs-devtools if anyone wants to carry on the work: https://github.com/gfredericks/schpec/issues/2#issuecomment-238005568