Oliver George 2021-07-04T10:23:22.271800Z

Are there any cute shortcuts for spec-ing re-frame event handler args? Typically I'm only interested in bits of what's passed and they are buried a few levels down. In this case I'd like to know the db has a :forms map, the location is a path string, route is a bidi map and resp is an anomaly or returned data containing the data I need.

[{:keys [db history/location]} [_ route resp]]

Oliver George 2021-07-04T10:25:36.272500Z

I fall to (s/asserts...) at the top of the implementation for convenience but it'd be nice to use s/fdef if it didn't end up super verbose.

ingesol 2021-07-05T08:38:13.274600Z

Ah, @vemv, didn’t notice you already answered this. I’m using speced.def, find it to be a great fit for re-frame events and subs

ingesol 2021-07-05T08:39:25.274800Z

primarily because of verbosity. There are many great libraries for specing functions, but I didn’t find any other that allows you to do something like this

(d/fn [{:keys [^::db-that-contains-form db]} [_ & ^::my-coll-spec args]]
    {:db (assoc db :something args)})

vemv 2021-07-05T11:06:05.275Z

Yes speced.def remains unique in destructuring support, and specing beyond defn (defprotocol, fn, let, etc) One thing that probably would be handy for cljs usage is failing asynchronously or in a custom manner so that the SPA won't fail irreversibly (as it can happen with :pre). I have related work in a branch, I simply haven't proceeded b/c I don't know much about who's using speced.def or their needs (and have my OSS plate quite full)

ingesol 2021-07-05T13:25:23.275800Z

I can only speak for myself, but so far there hasn’t been a need for CLJS specific handling. The type errors I want to catch don’t happen much in the wild

ingesol 2021-07-05T13:25:40.276Z

so mostly a dev tool for us, at least so far

p-himik 2021-07-04T10:50:42.272600Z

There's also :pre in Clojure, but it would probably be just as verbose.

vemv 2021-07-04T13:49:47.272800Z

don't all the spec-related libs tackle this? orchestra, guardrails, speced.def (my creation; it's particularly handy for inlining specs) etc