malli

2026-04-26T11:56:02.293549Z

Can I combine a custom schema registry with functions schemas ? This does not work:

{:malli/schema
   [:function
    {:registry malli/malli-registry}
    [:=>
     [:cat
      [:sequential [:or vector? fn?]]
      [:sequential [:map {:closed true}
                    [:split-uid {:optional true} string?]
                    [:train [:fn dataset?]]
                    [:test  {:optional true} [:fn dataset?]]]]
      fn?
      [:enum :accuracy :loss]]

     :scicloj.metamorph.ml/optimize-hyperparas--evaluation-result]
where
malli/malli-registry
is a custom 'compound registry

2026-04-26T11:57:54.970969Z

I gen an "invalid schema" exception, when instrumenting the function

2026-04-27T15:02:16.313389Z

I don't think you can use Registry objects as :registry. https://github.com/metosin/malli/issues/913 You should add : and its deps to the global registry instead https://github.com/metosin/malli#changing-the-default-registry

2026-04-27T15:03:16.631249Z

Or if it doesn't have IntoSchema's and you're not in CLJS you can probably try {:registry (mr/-schemas malli/malli-registry)}.

2026-04-27T21:58:04.721099Z

Another common solution is to define malli-registry as data like (def malli-registry {::foo int?, ::bar :any}) then plug it in wherever it needs to go. Uses more memory tho.