Created
June 23, 2017 22:00
-
-
Save bhb/6f06dd07bcf5b275a7d4faf3167bfc85 to your computer and use it in GitHub Desktop.
A case where the `:in` value is not a path to the value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;[org.clojure/clojure "1.9.0-alpha17"] | |
;;[org.clojure/clojurescript "1.9.542"] | |
;;[org.clojure/spec.alpha "0.1.123"] | |
(s/def :foo.user/name string?) | |
(s/def :foo/user (s/keys :req-un [:foo.user/name])) | |
(s/def :foo/user-map (s/map-of :foo.user/name :foo/user)) | |
(s/explain-data :foo/user-map {"bob" {:age 2 :city "chicago"}}) | |
;; returns the following... | |
(comment | |
#:cljs.spec.alpha{:problems | |
({:path [1], | |
:pred (contains? % :name), | |
:val {:age 2 :city "chicago"}, | |
:via [:foo/user-map :foo/user], | |
:in ["bob" 1]})}) | |
;; I would (perhaps mistakenly?) expect the `:in` value to be just ["bob"] since | |
;; (get-in {"bob" {:age 2 :city "chicago"}} ["bob"]) is {:age 2 :city "chicago"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment