This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-22
Channels
- # beginners (104)
- # bitcoin (1)
- # boot (5)
- # clara (3)
- # cljs-dev (14)
- # cljsjs (5)
- # cljsrn (1)
- # clojure (242)
- # clojure-italy (17)
- # clojure-news (13)
- # clojure-norway (3)
- # clojure-russia (101)
- # clojure-spec (41)
- # clojure-uk (87)
- # clojurescript (38)
- # core-async (38)
- # cursive (6)
- # datomic (11)
- # defnpodcast (3)
- # docs (14)
- # editors (8)
- # events (1)
- # fulcro (7)
- # hoplon (25)
- # leiningen (4)
- # luminus (7)
- # off-topic (25)
- # onyx (1)
- # portkey (14)
- # random (1)
- # re-frame (7)
- # reagent (4)
- # rum (4)
- # schema (8)
- # shadow-cljs (257)
- # spacemacs (10)
- # specter (4)
- # unrepl (3)
- # yada (1)
there is a Schema Walker in schema-tools if that helps https://github.com/metosin/schema-tools/blob/master/src/schema_tools/walk.cljc
And a (nice?) sample walk in https://github.com/metosin/schema-viz/blob/master/src/schema_viz/core.clj
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" schemaslike 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.