This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-27
Channels
- # bangalore-clj (2)
- # beginners (41)
- # cider (14)
- # cljs-dev (12)
- # cljsrn (2)
- # clojure (106)
- # clojure-austin (6)
- # clojure-dev (22)
- # clojure-dusseldorf (1)
- # clojure-france (1)
- # clojure-greece (17)
- # clojure-italy (6)
- # clojure-poland (3)
- # clojure-russia (10)
- # clojure-serbia (5)
- # clojure-spec (24)
- # clojure-uk (100)
- # clojurescript (126)
- # cursive (3)
- # data-science (5)
- # datascript (15)
- # datomic (3)
- # defnpodcast (2)
- # dirac (6)
- # emacs (10)
- # fulcro (121)
- # graphql (30)
- # hoplon (7)
- # jobs (2)
- # leiningen (20)
- # off-topic (14)
- # onyx (3)
- # other-languages (13)
- # pedestal (1)
- # perun (2)
- # planck (41)
- # re-frame (16)
- # reagent (6)
- # reitit (5)
- # remote-jobs (3)
- # ring (1)
- # ring-swagger (17)
- # shadow-cljs (137)
- # spacemacs (6)
- # sql (4)
- # uncomplicate (7)
- # unrepl (56)
- # vim (27)
Is there a way to get spec information similar to how I can use meta
to get info on a function? So if I have a spec like (s/def ::example string?)
is there some function I can call to see the spec definition? Even better, is there anything that will give me a list of specs in the namespace? Thanks!!!
yes, you can call (doc ::example)
you’d have to write something to filter specs per namespace
@taylor related to “similar to swagger” - if specs could be read back from their s/form
without eval
(I think it could be done already with undocumented part of the spec - but Rich might be doing something functional for this?), we could have a pragmatic subset of specs that could be safely used between servers & clients. and build swagger-like docs for them.
we could publish the s/form
as vendor extension to the spec-tools swagger-docs. e.f. :x-spec "(clojure.spec/keys :req [:user/x])"
+ :x-specs
on top-level as the spec-registry for the related specs. Non-clojure clients could use swagger/openapi and clojure-clients just the spec-part.
Call to clojure.core/if-let did not conform to spec: In: [2] val: :clojure.spec.alpha/invalid fails at: [:args :else] predicate: any?
@U050MP39D ah, thanks!
is there a way to say: ::foo is a COLLECTION such that (map :get-some-key ...) creates an unique list and if this fails, print out the entire collection
(s/def ::my-map (s/keys :req [::get-some-key]))
(s/def ::my-coll (s/and (s/coll-of ::my-map)
#(= (count %)
(count (set (map ::get-some-key %))))))
(s/explain ::my-coll [{::get-some-key 1} {::get-some-key 1}])
Is there a minimally ugly way to compare specs from two projects (like two versions of the same codebase)? One idea that comes to mind is loading one set of specs into a separate registry, but that looks like it's been made deliberately hard. Is there maybe a way to blow away the spec registry entirely to restart from scratch?
specs are fully namespaced with the idea that they'll be unique across projects, so caveat is anything you do that's assuming different is going to end up weird. but, if you want, I'm pretty sure you could just reset! the atom that is the spec registry