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]])
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})))
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!
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.
@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.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
looking forward to that!