clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
seancorfield 2020-07-24T22:07:35.041100Z

I don't know how many folks here follow http://ask.clojure.org but it would be nice for someone to go and answer this https://ask.clojure.org/index.php/9486/how-to-consume-the-chan-return-by-go-block-in-cljs

kenny 2020-07-24T23:47:24.042300Z

(s/valid?
    (s/keys)
    report-data)
=> false
(s/explain-data
    (s/keys)
    report-data)
=> nil
(s/valid? (s/keys) (apply hash-map report-data))
=> true
(type report-data)
=> clojure.lang.PersistentArrayMap

kenny 2020-07-24T23:47:48.042900Z

Any idea what's going on there?

seancorfield 2020-07-24T23:56:12.043400Z

@kenny I can't repro with Spec 1. Is that Spec 1 or Spec 2 you're using?

kenny 2020-07-24T23:56:19.043600Z

Spec 1

seancorfield 2020-07-24T23:56:33.043900Z

user=> (require '[clojure.spec.alpha :as s])
nil
user=> (def report-data {:a 1 :b 2})
#'user/report-data
user=> (type report-data)
clojure.lang.PersistentArrayMap
user=> (s/valid? (s/keys) report-data)
true
user=> (s/explain-data
    (s/keys)
    report-data)
nil
user=> (s/valid? (s/keys) (apply hash-map report-data))
true
user=> 

seancorfield 2020-07-24T23:57:27.044300Z

What sort of keys are in your report-data map?

kenny 2020-07-24T23:58:55.044600Z

Keywords

kenny 2020-07-24T23:59:00.044800Z

Did you mean something else?