Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested map #27

Closed
cjohansen opened this issue Sep 15, 2017 · 5 comments
Closed

Nested map #27

cjohansen opened this issue Sep 15, 2017 · 5 comments
Labels

Comments

@cjohansen
Copy link

cjohansen commented Sep 15, 2017

I have a case that's working with spec, but failing with expound:

(require '[clojure.spec.alpha :as s]
         '[expound.alpha :as e])

(s/def :db/valueType #{:db.type/ref})
(s/def :db/cardinality #{:db.cardinality/one :db.cardinality/many})
(s/def :db/unique #{:db.unique/identity})
(s/def ::attribute-schema (s/keys :opt [:db/valueType :db/cardinality :db/unique]))
(s/def ::schema (s/map-of keyword? ::attribute-schema))

(s/explain-str ::schema {:some/value {:db/unique :db.unique/value}})
;;In: [:some/value 1 :db/unique] val: :db.unique/value fails spec: :db/unique at: [1 :db/unique] ;;predicate: #{:db.unique/identity}
;;:clojure.spec.alpha/spec  :user/schema
;;:clojure.spec.alpha/value  #:some{:value #:db{:unique :db.unique/value}}

(e/expound-str ::schema {:some/value {:db/unique :db.unique/value}})
;;AssertionError Assert failed: clojure.lang.LazySeq@8de948aa
;;(every? :expound/in leaf-problems)  expound.alpha/printer-str (alpha.cljc:541)

Clojure 1.9.0-alpha19

@bhb
Copy link
Owner

bhb commented Sep 15, 2017

@cjohansen Thanks very much for reporting this! I'll take a look ASAP.

@cjohansen
Copy link
Author

Awesome. Let me know if you need help or more information.

@bhb bhb added the bug label Sep 18, 2017
@bhb
Copy link
Owner

bhb commented Sep 20, 2017

@cjohansen Thanks for reporting this! Would you mind trying out 0.3.1-SNAPSHOT to confirm this works with your specs?

@cjohansen
Copy link
Author

Works perfectly! Nice work 👍

@bhb
Copy link
Owner

bhb commented Sep 27, 2017

Thanks again for your help on this! I've just released Expound 0.3.1 which includes this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants