Fork me on GitHub
#malli
<
2021-01-06
>
ordnungswidrig11:01:10

Give a definition like

(def Foo [:schema {:registry {"Foo" [:map [:bar pos-int?}  "Foo"])
Is there a way to “resolve” that schema to the actual schema referenced by “Foo”? I want to programatically access the actual definition of “Foo”, e.g. to enumerate the map fields. I’ve look through the properties, options, children and reference of the schema created by (m/schema Foo) but I’m a little lost.

ikitommi17:01:15

there is also m/deref-all, which peels all top-level RefSchemas.

ikitommi17:01:40

also, you can always m/walk the schema with option :malli.core/walk-refs, which walks over all refs. Not sure of that one blows up with recursive schemas...

ordnungswidrig17:01:46

Oh, i had tried ref but not deref.