Fork me on GitHub
#malli
<
2020-07-31
>
ikitommi16:07:58

After #238, there will be two ways to program with schemas: via schema keys (`:in` in explain) and value keys (`:path`in explain). e.g. one can walk easily over parts of schemas that don’t effect the value paths:

(def Schema
  (m/schema
    [:maybe
     [:and
      [:map
       [:id string?]
       [:tags [:set keyword?]]
       [:address
        [:and
         [:map
          [:street {:optional true} string?]
          [:lonlat {:optional true} [:tuple double? double?]]]
         [:fn '(fn [{:keys [street lonlat]}] (or street lonlat))]]]]
      [:fn '(fn [{:keys [id tags]}] (and id tags))]]]))

(mu/get-in Schema [0 0 :address 0 :lonlat])
; => [:tuple double? double?]

(mu/get-in* Schema [:address :lonlat])
; => [:tuple double? double?]