Fork me on GitHub
#malli
<
2021-05-07
>
Siddharth14:05:58

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

dharrigan14:05:49

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.

👌 2
dharrigan14:05:50

That may work

dvingo15:05:17

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

👍 2
Siddharth15:05:11

thanks guys, sounds good, cheers

ikitommi16:05:57

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

🕶️ 2
👌 2