metosin / schema-tools

Clojure(Script) tools for Plumatic Schema
http://metosin.github.io/schema-tools/
Eclipse Public License 2.0
107 stars 16 forks source link

schema-tools.walk/walk doesn't work with s/recursive #29

Closed ikitommi closed 8 years ago

ikitommi commented 8 years ago

s/recursive expects it's value to be instance of clojure.lang.IDeref, so this line fails:

(-walk [this inner outer]
  (outer (with-meta (s/recursive (inner (:derefable this))) (meta this))))
ikitommi commented 8 years ago

https://github.com/plumatic/schema/blob/master/src/cljx/schema/core.cljx#L666

Deraen commented 8 years ago

Not sure what we could do here, probably the user has to make sure inner returns derefable if it is given one. Maybe we could wrap result in derefable if it isn't one, but I'm not sure if that functionality makes any sense.

ikitommi commented 8 years ago

Schema core checks the recursive value with var?, so re-wrapping needs to retain the original derefable type. Will resolve this in the client side. Thanks!