Fork me on GitHub

Has anyone worked on a datalog spec?


@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.


Yep, makes sense :)


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
   {: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:


i’ve done the small amount of plumbing required, and what’s left is to experiment with making it look nice