malli

https://github.com/metosin/malli :malli:
ikitommi 2021-05-07T04:01:37.249300Z

you can configure the the mu/merge with few options, see`:merge-default` in mu/union https://github.com/metosin/malli/blob/master/src/malli/util.cljc#L104-L113

ikitommi 2021-05-07T04:03:25.249600Z

Would that be mu/intercect with :and ? If so, PR welcome.

Siddharth Jain 2021-05-07T14:49:58.253Z

is there a way I can set all map schema :closed by default? so that don't need to specify individually.

dharrigan 2021-05-07T14:59:49.253900Z

I don't think there is, however, you could gather up all your schemas and map over them with malli.utils/closed-schema to recursively close them.

👌 1
dharrigan 2021-05-07T14:59:50.254200Z

That may work

2021-05-07T15:06:17.256Z

You could copy the -map-schema definition and make your own -closed-map-schema https://github.com/metosin/malli/blob/master/src/malli/core.cljc#L616 so you could write: [:closed-map [:xyz string?]] not sure if that's worth it vs just typing {:closed true} though

👍 1
Siddharth Jain 2021-05-07T15:17:11.257800Z

thanks guys, sounds good, cheers

ikitommi 2021-05-07T16:10:57.258400Z

@siddharthjain.in or better: create a PR that allows m/-map-schema to take :closed and then say:

(m/-map-schema {:naked-keys true, :closed true})
.. and you have a closed variant.

🕶️ 1
👌 1