malli

https://github.com/metosin/malli :malli:
helios 2020-11-24T15:18:06.128200Z

It's not clear how i could say that i want a non-empty map in my schema, that also works with generators 🙂

helios 2020-11-24T15:27:59.128500Z

(mg/generate [:and
              [:fn not-empty]
              [:map-of
               [:string {:gen/gen gen/string-ascii}]
               [:string {:gen/gen gen/string-ascii}]]])
this ofc works for validation but not with generators

ikitommi 2020-11-24T15:53:33.128700Z

@helios try reversing that, :map-of as first child. :and generates based on first, and narrows with the rest.

✔️ 1
helios 2020-11-24T15:54:20.128900Z

uh, nice one 🙂

Hankstenberg 2020-11-24T21:19:05.131700Z

malli is absolutely awesome, thanks a lot guys! đź‘Ť

🙇 1
ordnungswidrig 2020-11-24T21:29:42.132500Z

Is there a “canonical representation” for malli? I guess it’s the “vector” syntax as opposed to the “map” syntax, right?