Completed
Details
Assignee
UnassignedUnassignedReporter
David NolenDavid NolenLabels
Approval
OkPatch
Code and TestPriority
MajorAffects versions
Fix versions
Details
Details
Assignee
Unassigned
UnassignedReporter
David Nolen
David NolenLabels
Approval
Ok
Patch
Code and Test
Priority

Affects versions
Fix versions
Created November 15, 2016 at 7:08 PM
Updated May 26, 2017 at 3:39 PM
Resolved May 26, 2017 at 3:39 PM
Currently, explain-data returns unresolved preds. This is a problem when trying to write a custom explain print function that chooses what to do based on the predicate as it does not have enough information.
(require '[clojure.spec :as s]) (defn password-valid-length? [pass] (> (count pass) 12)) (s/def ::password (s/and string? password-valid-length?)) (-> (s/explain-data ::password "foobar") ::s/problems first :pred) ;;=> password-valid-length? ;;expected: user/password-valid-length?
Cause: Currently, explain* returns preds in the abbrev form for all spec impls.
Proposed: Have explain* return resolved preds. In cases where the abbreviated form should be used (anything for human consumption at either the repl or an error message), convert to it. For example, explain-printer should (and already does) do this.
Patch: clj-2059-2.patch
Changes all spec impls to avoid calling abbrev on preds when building explain-data
Undoes op-describe change for s/? in CLJ-2042 and fixes this at a higher level by calling res on the incoming pred (this is a better fix)
Changes the expected test output for spec tests to expect the resolved pred