On Monday, June 27, 2016 at 12:45:07 PM UTC-7, Brent Millare wrote: > > I'm playing with clojure.spec (alpha7) to validate a data structure > storing information about workout history using the following code: > <snip>
> > The problem is that when using s/explain on an invalid input where the > error is near the leaves, the error message points at the root of the data > structure, which is not as useful. > > (s/explain > ::history > {[2015 6 31] {:chinups [(->rep_scheme 0 13) > (->rep_scheme :x 13)] > :l-sit [(->duration 0 0 10)]} > [2016 6 31] {:chinups [(->rep_scheme 0 13) > (->rep_scheme 0 14)] > :l-sit [(->duration 0 0 10)]}}) > > val: {[2015 6 31] {:chinups [#v.scratch.lift_tracker.rep_scheme{:weight 0, > :repetitions 13} #v.scratch.lift_tracker.rep_scheme{:weight :x, > :repetitions 13}], :l-sit [#v.scratch.lift_tracker.duration{:hours 0, > :minutes 0, :seconds 10}]}, [2016 6 31] {:chinups > [#v.scratch.lift_tracker.rep_scheme{:weight 0, :repetitions 13} > #v.scratch.lift_tracker.rep_scheme{:weight 0, :repetitions 14}], :l-sit > [#v.scratch.lift_tracker.duration{:hours 0, :minutes 0, :seconds 10}]}} > fails spec: :v.scratch.lift-tracker/history predicate: (coll-checker (tuple > :v.scratch.lift-tracker/date :v.scratch.lift-tracker/workout)) > > Is there a built in way to automatically recurse the sub-components to > identify the problematic scope? > I filed an issue about the error messaging for `map-of`: http://dev.clojure.org/jira/browse/CLJ-1946 ; might be worth adding a note/vote to that. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.