It does work if the registry is passed in the options map
(mu/optional-keys
[:map
[:time :inst]
[:id :uuid]]
{:registry
(mr/composite-registry
m/default-registry
{:inst (m/-simple-schema
{:type :inst
:pred inst?})})})
Is there a preferred way to ensure that a seqex schema is a given collection type? right now I can use [:and vector? [:catn [:bool :boolean] [:int :int]]]
, but I was wondering if there was a more canonical or performant way of doing it (generators often fail to satisfy the predicate, for example).
No. I think it only matters for generators and :and
is in general not generator-friendly (currently the generator is a gen/such-that
, which is pretty bad but how much better can we even get?)
(For that particular example I would probably use [:tuple :boolean :int]
but you might really have something that actually needs seqex)
yeah, that was a deliberately simplified example (the actual motivating use case is validation on hiccup forms). I think I'll need to take a crack at custom generators for this use case.
I think I've seen some discussion of this previously and it should be simple to add. So maybe file an issue as well?
It is unfortunate that we have to add non-orthogonal props like [:string {:min 5}]
and now maybe [:catn {:type :vector}]
to get decent generators
minimallist
has an additional https://github.com/green-coder/minimallist/blob/f10ebbd3c2b93e7579295618a7ed1e870c489bc4/src/minimallist/helper.cljc#L72 that does this, minimallist.helper/in-vector
, but it chooses a map-based representation for schemas that allows additional metadata of :coll-type
to be assoc'd to the schema. Unclear how something similar would work in malli
.
It would just add that to props but the seqex schemas still have to be updated to use that information