malli

https://github.com/metosin/malli :malli:
ordnungswidrig 2021-01-06T11:20:10.347Z

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.

ikitommi 2021-01-06T17:01:02.347800Z

@ordnungswidrig try (m/deref Foo)

ikitommi 2021-01-06T17:02:15.349600Z

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

ikitommi 2021-01-06T17:04:40.352200Z

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...

ordnungswidrig 2021-01-06T17:39:46.353100Z

Oh, i had tried ref but not deref.