Fork me on GitHub
#malli
<
2021-04-27
>
Adam Helins07:04:14

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]])

Adam Helins11:04:03

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 Fedorov11:04:49

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 Fedorov12:04:14

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.

ikitommi18:04:06

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

❤️ 3
Ben Sless15:04:38

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

ikitommi16:04:17

looking forward to that!