Skip to content

Commit 3db1e2a

Browse files
committed
add api to readme
1 parent 07ee46c commit 3db1e2a

1 file changed

Lines changed: 31 additions & 3 deletions

File tree

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ org.clojure/tools.deps.edn {:mvn/version "0.9.13"}
3131

3232
[Maven](https://maven.apache.org) dependency information:
3333

34-
```
34+
```xml
3535
<dependency>
3636
<groupId>org.clojure</groupId>
3737
<artifactId>tools.deps.edn</artifactId>
@@ -41,9 +41,37 @@ org.clojure/tools.deps.edn {:mvn/version "0.9.13"}
4141

4242
# API
4343

44-
For info on using tools.deps.edn as a library, see:
44+
## Reading, validating, and canonicalization
45+
46+
Usually, you should use the `read-deps` function to read a deps.edn file, validate, and canonicalize it:
47+
48+
* (read-deps f & opts) - coerce f to a File, then read, validate, canonicalize and return a deps.edn map
49+
50+
However, these component functions may also occasionally be useful:
51+
52+
* (read-edn r & opts)` - reads a single edn value from a Reader r
53+
* (validate deps-edn & opts) - validate a deps.edn map against the specs and throw or return the valid map
54+
* (canonicalize deps-edn & opts) - canoncialize a deps.edn map and return it
55+
56+
## Deps chain
57+
58+
These functions are available to get individual or multiple of the standard deps.edn maps in the chain:
59+
60+
* ([root-deps](https://clojure.github.io/tools.deps.edn/#clojure.tools.deps.edn/root-deps)) - return the root deps read as a resource
61+
* ([user-deps-path](https://clojure.github.io/tools.deps.edn/#clojure.tools.deps.edn/user-deps-path)) - calculate the path to the user deps.edn
62+
* ([user-deps](https://clojure.github.io/tools.deps.edn/#clojure.tools.deps.edn/user-deps)) - use `user-deps-path`, then read and return it (or nil if none exists)
63+
* ([project-deps-path](https://clojure.github.io/tools.deps.edn/#clojure.tools.deps.edn/project-deps-path)) - calculate the path to the project deps.edn, using the dir context as the current directory
64+
* ([project-deps](https://clojure.github.io/tools.deps.edn/#clojure.tools.deps.edn/project-deps)) - use `project-deps-path`, then read and return it (or nil if none exists)
65+
* ([create-edn-maps](https://clojure.github.io/tools.deps.edn/#clojure.tools.deps.edn/create-edn-maps)) ([create-edn-maps](https://clojure.github.io/tools.deps.edn/#clojure.tools.deps.edn/create-edn-maps) params-map) - takes optional map of location sources and returns a map of the root, user, project, and extra deps.edn maps
66+
67+
## Data manipulation
68+
69+
These functions can be used to modify or extract information from a deps.edn map:
4570

46-
* [API Docs](https://clojure.github.io/tools.deps.edn)
71+
* ([merge-edns](https://clojure.github.io/tools.deps.edn/#clojure.tools.deps.edn/merge-edns) deps-edn-maps) - merge multiple deps.edn maps in a chain
72+
* ([merge-alias-maps](https://clojure.github.io/tools.deps.edn/#clojure.tools.deps.edn/merge-alias-maps)) - like merge-with, for merging alias maps with per-key rules
73+
* ([combine-aliases](https://clojure.github.io/tools.deps.edn/#clojure.tools.deps.edn/combine-aliases)) - find, read, and combine alias maps identified by alias keywords from
74+
a deps edn map into a single args map.
4775

4876
# Developer Information
4977

0 commit comments

Comments
 (0)