Fork me on GitHub
#schema
<
2017-09-22
>
ikitommi05:09:49

not sure thou if that's what you were looking for.

nha08:09:00

There are some interesting things in there, but I don't think I can use it as-is. My use case is to transform a possibly nested schema into a "flat" schema (where the top-level map has only top-level keys). Ie. from {:a {:b {:c s/Str :d s/Int}}} to {:a_b_c s/Str :a_b_d s/Int} So I need to walk and transform, but walk only the leaves, and since

(map? s/Any) ;;=> true
I need a way of detecting "primitive" schemas

nha08:09:33

(unless I misunderstood some things in walk - not familiar with the internals of schema)

ikitommi13:09:38

like plumbing.map/[flatten|unflatten] for Schemas? If you only have nestes schema maps, it should be easy to walk over different keys (required, optional, normal). Schema-tools has some helpers for the keys. If you want to support also things like s/maybe in the path or sequential schemas, then haven't seen anything ready out there.

nha17:09:06

Yes, similar to that 🙂 There are no maybe in the path (but optional-key yes). And there are annoyances with s/if as well. Looks like I will have to make my own 🙂

nha17:09:27

Maybe taking plumbing.map/[flatten|unflatten] and modifying it for schemas would work