malli

https://github.com/metosin/malli :malli:
ikitommi 2021-05-28T04:57:25.046500Z

have looked at it, but haven’t heard of anyone using. not super popular.

ikitommi 2021-05-28T04:57:50.046700Z

but, I nice idea. not sure how many ways there are to describe such things.

Pragyan Tripathi 2021-05-28T07:50:10.046900Z

Is there a way I can use malli to generate datomic schema?

eoliphant 2021-05-28T20:53:06.055200Z

not ‘out of the box’ per se but it’s pretty straight forward. depends on the way you define your schemas. We use the dynamic registry sort of like spec, so our attributes are first class which sort naturally maps to datomic, and then just map over the registry for our attrs, :{db/ident <attr> :db/valueType (malli-to-datomic …) …} theres of course specific stuff you’ll probably do for enums :my/enum [:enum :a :b] becomes norms for a :my/enum ref and :my.enum/a, etc. :map’s to refs, etc. We have our own custom options for additional customization when we generate.

👍 1
eoliphant 2021-05-28T20:56:01.056100Z

also, this video talks about this in general in terms of using malli to drive a lot of the rest of your app. https://www.youtube.com/watch?v=ww9yR_rbgQs&t=696s

eoliphant 2021-05-28T21:05:08.058900Z

is there a way to muck with option values based on a predicate? in pseudo-malli…

[:map 
  [:a :boolean]
  [:b {:optional #(true? :a)} :boolean]]