Fork me on GitHub
#clojure-spec
<
2020-12-07
>
Aleh Atsman16:12:16

Hello! Is there a way to get list of keys from (s/keys...) ? And if I had few specs merged can I get back a full list of keys? If not, how do you do it? Thx

Aleh Atsman15:12:10

explain data approach - maybe but clojure.spec/form - doesn't work for merged spec thanks for links

Aleh Atsman15:12:55

both ways feels more hacky than just abstracting clojure.spec away and managing things by hands

misha15:12:09

For merged specs probably need to walk it doing s/form and s/registry. Walking datastructures ain’t hacky in a Lisp :op:

misha15:12:12

They say spec2 is gonna be easier in this regard, fwiw

Aleh Atsman17:12:13

Well, I am simple guy and solved my problem with first creating entities as plain maps, later wrapping decision on what fields to use in 2 level multimethods, only from there creating spec, and returning it together with fields 🙂