malli

https://github.com/metosin/malli :malli:
emccue 2021-03-12T00:42:14.338400Z

(looped back to this, i'm probably wrong and got confused by the "inferred schema" part and also my bad memory)

raymcdermott 2021-03-12T12:59:33.340700Z

I want to protect the swagger doc built from the malli data model using buddy. I have seen the reitit examples which protect routes but it's not clear how this integrates into the Swagger model ... I will also x post to reitit

raymcdermott 2021-03-12T15:52:20.341200Z

[ thanks for the answer by @ikitommi in #reitit ]

ikitommi 2021-03-12T18:39:45.342400Z

many ways of stripping extra keys from maps: https://www.reddit.com/r/Clojure/comments/m3hx1e/how_do_i_walk_a_complex_map_and_remove_keys_based/

borkdude 2021-03-12T21:36:52.344500Z

Just had a thought. Can malli be used in places where currently meander or matchete (https://github.com/xapix-io/matchete) are used? Although this works, it is a bit cumbersome:

user=> (m/validate [:cat [:enum 1] :any [:enum 3]] '[1 2 3])
true

borkdude 2021-03-12T21:39:22.345200Z

And how could I get the destructured value, after validation?

user=> (m/explain [:catn [:a [:enum 1]] [:b :any] [:c [:enum 3]]] '[1 2 3])
nil

borkdude 2021-03-12T22:29:30.345600Z

oh of course, parse 🤦

user=> (m/parse [:catn [:a [:enum 1]] [:b :any] [:c [:enum 3]]] '[1 2 3])
{:a 1, :b 2, :c 3}

borkdude 2021-03-12T22:49:37.346100Z

Is there a way to indicate that you want to ignore a certain binding in the parsed output?

borkdude 2021-03-12T22:57:27.346300Z

I hacked it like this: https://gist.github.com/borkdude/26906ee15585ed5e1b7a8eda4cc1ee18

👍 2