malli

https://github.com/metosin/malli :malli:
Helins 2021-04-27T07:20:14.018300Z

After WASM, I am now describing a Lisp using Malli and once again am doing heavy use of recursive generation. I'm probably gonna be spamming a few questions in the following days. That kind of :set are always empty, am I doing something wrong with :ref? No such problem with :vector.

(malli.gen/sample [:set
                   {:registry {::foo :int}}
                   [:ref ::foo]])

Helins 2021-04-27T11:44:03.021800Z

Is there any design decision behind not generating NaN and Infinity?

(defmethod -schema-generator :double [schema options] (gen/double* (merge (-min-max schema options) {:infinite? false, :NaN? false})))

Ivan Fedorov 2021-04-27T11:45:49.023200Z

Any good intro? I’m playing with schemas, and can’t see a formal definition of it in README Currently I’m thinking that [:schema] schemas must have a :registry followed by a single root subschema reference. I’ve watched the talk by Tommi Reiman from London Clojurians. It’s helpful, but I’m lacking some formal learning material. Thanks in advance!

Ivan Fedorov 2021-04-27T12:10:14.025600Z

I’m trying to understand the best way to describe the entity types of an app. Probably it’s just a single big registry then and multiple (def schema:entity-type-n) using it.

ikitommi 2021-04-27T18:48:06.030600Z

@ognivo most malli-based projects I’ve seen use a mutable global registry with custom register function like spec (README has a guide how to set that up), registering looks like:

(register :user/id :int)
you can also just define schemas as var in schema style, using the default immutable regisitry:
(def Userid :int)
there was an Entities and Values guide in the README, but it was removed.

❤️ 1
Ben Sless 2021-04-28T15:23:38.035Z

It's also possible to delay schema compilation and registry instantiation to start-up time. I built a registry dynamically and injected it into a Component system, the registry itself contained content dependent schemas which depended on input arguments. It was fun. I might cajole my employer to let write something about it

ikitommi 2021-04-28T16:52:17.035200Z

looking forward to that!