Fork me on GitHub
#malli
<
2023-07-19
>
cap10morgan19:07:03

Should this work?

(-> (m/schema ::my-schema {:registry {::my-schema string?}})
    m/ast
    m/from-ast)
...because it doesn't seem to. throws malli.core/invalid-schema b/c the m/ast call returns {:type :malli.core/schema, :value :full.ns/my-schema}

cap10morgan20:07:30

(pretend I merged in malli.core/predicate-schemas)

dvingo16:07:31

You need to pass the registry to all of the calls:

(let [opts {:registry (merge (m/default-schemas) {::my-schema string?})}]
    (-> (m/schema ::my-schema opts)
      (m/ast opts)
      (m/from-ast opts)))

dvingo17:07:21

This also works:

(m/from-ast
    (m/ast
      [:schema {:registry {::my-schema string?}}
       ::my-schema]))

cap10morgan18:07:30

hmm, that doesn't fix it for me. same error. same return value from m/ast

dvingo19:07:58

which version? can you post some code?

dvingo19:07:02

both are working for me