Fork me on GitHub
#tools-deps
<
2019-09-18
>
cfleming00:09:42

Has anyone made a spec for deps files that I could use to check validity?

cfleming00:09:04

It’s probably not hard to put together, but I wasn’t sure if anything already existed.

Alex Miller (Clojure team)00:09:09

I think there are some in tools.deps

Alex Miller (Clojure team)00:09:32

but I don't actually use them atm, so they might not be totally up to date (but I'd be happy to fix that)

cfleming00:09:46

Ok, I’ll check them out, thanks.

cfleming00:09:42

I’d like to make at least a basic check that the file looks good before automatically trying to resolve it on file modification.

Alex Miller (Clojure team)00:09:44

::deps-map in particular

cfleming00:09:27

You think ::deps-map might not be up to date?

Alex Miller (Clojure team)00:09:42

just eyeballing it, it can't be too far off

cfleming00:09:06

I’m mostly interested validating the input, i.e. the deps file itself, not what t.d.a returns.

Alex Miller (Clojure team)00:09:27

yeah that ::deps-map is a deps.edn file contents

Alex Miller (Clojure team)00:09:10

I'm pretty sure I'm not using those specs in the mainline code right now so it's probably as good as any code you aren't using

cfleming00:09:56

Ok. I might have a go at converting this to my internal validator, which means I could show errors in the editor too.

cfleming00:09:30

As well as checking before trying to resolve automatically.

Alex Miller (Clojure team)00:09:01

I don't see anything wrong in those specs. it's missing :sha and maybe one or two other things

cfleming00:09:26

Ok, if I see any obvious errors I’ll make a PR

cfleming00:09:35

Or a patch, rather.

Alex Miller (Clojure team)00:09:10

or just tell me and I'll fix it :)

cfleming00:09:20

These days, when supplying a patch, does it have to be attached to a JIRA? Or can it be attached to http://ask.clojure.org?

cfleming00:09:25

Or that, yes 🙂

Alex Miller (Clojure team)00:09:33

as someone that's supposed to be writing a talk right now, I'm in the market for sources of procrastination :)

cfleming00:09:56

Meh, you still have two weeks, what’s the issue?

cfleming02:09:26

What are plane flights for?

cfleming00:09:06

This is probably more of a question for #spec, but I’m curious about this:

(s/def :local/coord (s/keys :req-un [:local/root] :opt-un [::path]))

cfleming00:09:34

Does that mean that :req-un can be used for namespaced keywords as long as the ns is explicitly specified?

cfleming00:09:38

Ah, no, ignore me - never mind.

cfleming00:09:31

Actually, no - the doc says: > These variants specify namespaced keys used to find their specification, but the map only checks for the unqualified version of the keys.

cfleming00:09:53

Does that mean that the spec would accept :root as well as :local/root?

Alex Miller (Clojure team)01:09:34

ha, I was off checking many things and independently discovered this - it's a bug

Alex Miller (Clojure team)01:09:52

I ran it on all the deps.edn in my system and that barfed at me in a few places

Alex Miller (Clojure team)01:09:16

also added the required :sha attr for git coords

Alex Miller (Clojure team)02:09:40

released as tda 0.7.549 if you need it

cfleming02:09:48

Great, thank you!

Ahmed Hassan03:09:39

What is :resource-paths (leiningen) counterpart in Tools Deps?

cfleming03:09:57

@ahmed1hsn Yes - Deps doesn’t make a distinction.

👍 4
Alex Miller (Clojure team)12:09:29

to be more accurate, the jvm doesn't make a distinction, and thus neither does deps

dominicm13:09:55

I stopped making the distinction in my programs too. I realised it was rather arbitrary.

seancorfield15:09:50

@ahmed1hsn You may find this blog post helpful https://corfield.org/blog/2018/04/18/all-the-paths/ since it talks about the terminology used by lein (and boot) and how that maps onto t.d.a.'s world.