This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-19
Channels
- # announcements (1)
- # beginners (115)
- # calva (7)
- # cider (8)
- # clj-kondo (3)
- # cljdoc (12)
- # clojure (50)
- # clojure-europe (4)
- # clojure-italy (5)
- # clojure-nl (6)
- # clojure-spec (70)
- # clojure-uk (88)
- # clojurescript (54)
- # core-async (16)
- # cursive (5)
- # datomic (31)
- # editors (4)
- # emacs (4)
- # fulcro (29)
- # graphql (17)
- # luminus (1)
- # lumo (2)
- # off-topic (37)
- # pathom (16)
- # random (2)
- # re-frame (5)
- # reitit (3)
- # rum (2)
- # shadow-cljs (192)
- # sql (11)
@kenny I think you're the person to comment on the seed
not necessarily following the rules of the cache (because of what @hiredman said) but I think I'll try to update the docs to make that clearer somehow...
Nothing specific. There are several ways of doing it.
(given the caveat of :x/a
and :y/a
would collapse onto the same unqualified key)
clojure.set/rename-keys
might make it easier if you have a fixed set of keys.
(zipmap ks (map (comp keyword name) ks))
would give you a map of qualified keys to unqualified keys that you could use with rename-keys
For an internal library, I'd like to implement a version check that alerts, if the library is outdated. How can I get the version number of the library when run inside the using app both in leiningen and uberjar? Can I write the version number somehow during publishing a version to our private repo (we use s3-wagon-private)? My best idea was to parse the class path, but that doesn't work for uberjars
@U06BE1L6T Interesting. Do you read from that edn when during runtime? My goal is to know the lib version when it's executed.
if it’s built with leiningen, you’ll also have META-INF/leiningen/<group>/<name>/project.clj
for all components of an uberjar, and META-INF/maven/<group>/<name>/pom.xml
for maven artifacts
so if i define a spec in a namespace other than the one im using it would that whole namespace be loaded?
(and related question - how can i validate a map where the name of the item in the map isnt the same name as the spec)
in fact I generally argue it is better to avoid using specific code namespaces and namespaces in your data, so the two are not coupled
and don't use '::' so you can copy and paste data freely without worrying about context
specs basically have a whole other system of names off to the side and don't store data or interact with code namespaces
can you write a predicate that returns true or false given some external data if it is the shape you want?
yes, but the s/keys made predicates "know" how to include the key name in the error message
user=> (defn contains-company-name? [x] (contains? x "companyName"))
#'user/contains-company-name?
user=> (s/explain contains-company-name? {})
{} - failed: contains-company-name?
nil
user=>
It’s probably easier to keywordize keys for stuff like this right now
and there are other ways to customize the behavior, and get more out of your predicates (generating, etc) but you can start there
@emccue https://corfield.org/blog/2019/09/13/using-spec/ might be helpful for you -- it talks about how @hiredman and I use Spec at work.