Skip to content

Commit 6bfba72

Browse files
committed
Tried to make cljdoc happy.
1 parent 781d5ee commit 6bfba72

File tree

8 files changed

+69
-47
lines changed

8 files changed

+69
-47
lines changed

doc/SUMMARY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
## Data
1414

15-
* [Data Validation](usage.md#data-validation)
16-
* [Data Generation](usage.md#data-generation)
15+
* [Data Validation](data_validation.md)
16+
* [Data Generation](data_generation.md)
1717

1818
## Misc
1919

doc/cljdoc.edn

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{:cljdoc.doc/tree [["Introduction" {:file "doc/README.md"}]
2+
["Design Choices" {:file "doc/design_choices.md"}]
3+
["Model Anatomy" {:file "doc/model_anatomy.md"}]
4+
["Model Builder" {:file "doc/model_builder.md"}]
5+
["Data Validation" {:file "doc/data_validation.md"}]
6+
["Data Generation" {:file "doc/data_generation.md"}]
7+
["Usage in Babashka" {:file "doc/babashka.md"}]]}

doc/usage.md renamed to doc/data_generation.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
# Usage
2-
3-
## Data Validation
4-
5-
```clojure
6-
(require '[minimallist.core :refer [valid?]])
7-
(require '[minimallist.helper :as h])
8-
9-
(valid? (h/fn string?) "Hello, world!")
10-
;=> true
11-
```
12-
131
## Data Generation
142

153
```clojure

doc/data_validation.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Data Validation
2+
3+
```clojure
4+
(require '[minimallist.core :refer [valid?]])
5+
(require '[minimallist.helper :as h])
6+
7+
(valid? (h/fn string?) "Hello, world!")
8+
;=> true
9+
```

pom.xml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>minimallist</groupId>
55
<artifactId>minimallist</artifactId>
6-
<version>0.0.2</version>
6+
<version>0.0.3</version>
77
<name>Minimallist</name>
88
<description>A minimalist data driven data model library, inspired by Spec and Malli.</description>
99
<url>https://github.com/green-coder/minimallist</url>
1010
<scm>
1111
<url>https://github.com/green-coder/minimallist</url>
12-
<connection>
13-
scm:git:git://github.com/green-coder/minimallist.git
14-
</connection>
12+
<connection>scm:git:git://github.com/green-coder/minimallist.git</connection>
13+
<developerConnection>scm:git:ssh://git@github.com/green-coder/minimallist.git</developerConnection>
1514
</scm>
1615
<licenses>
1716
<license>
@@ -31,6 +30,12 @@
3130
<artifactId>clojure</artifactId>
3231
<version>1.10.1</version>
3332
</dependency>
33+
<dependency>
34+
<groupId>org.clojure</groupId>
35+
<artifactId>test.check</artifactId>
36+
<version>1.1.0</version>
37+
<scope>provided</scope>
38+
</dependency>
3439
</dependencies>
3540
<build>
3641
<sourceDirectory>src</sourceDirectory>

src/minimallist/core.cljc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@
3434

3535
;;---
3636

37-
(defmacro implies [condition & expressions]
38-
`(if ~condition
39-
(do ~@expressions)
37+
(defmacro ^:no-doc implies
38+
"Logically equivalent to `(or (not condition) expression)`"
39+
[cause consequence]
40+
`(if ~cause
41+
~consequence
4042
true))
4143

4244
(declare -valid?)

src/minimallist/generator.cljc

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,49 @@
99
;; Helpers for generating non-structural data.
1010
;; If you can't find what you need here, you can define your own helpers.
1111

12-
(def fn-any? (-> (h/fn any?)
13-
(h/with-test-check-gen gen/any)))
12+
(def ^{:doc "A model that matches and generates anything."}
13+
fn-any? (-> (h/fn any?)
14+
(h/with-test-check-gen gen/any)))
1415

15-
(def fn-any-simple? (-> (h/fn any?)
16-
(h/with-test-check-gen gen/simple-type)))
16+
(def ^{:doc "A model that matches anything and generates any scalar type."}
17+
fn-any-simple? (-> (h/fn any?)
18+
(h/with-test-check-gen gen/simple-type)))
1719

18-
(def fn-nil? (-> (h/fn nil?)
19-
(h/with-test-check-gen (gen/return nil))))
20+
(def ^{:doc "A model that matches and generates the nil value."}
21+
fn-nil? (-> (h/fn nil?)
22+
(h/with-test-check-gen (gen/return nil))))
2023

21-
(def fn-boolean? (-> (h/fn boolean?)
22-
(h/with-test-check-gen (gen/elements [false true]))))
24+
(def ^{:doc "A model that matches and generates booleans."}
25+
fn-boolean? (-> (h/fn boolean?)
26+
(h/with-test-check-gen (gen/elements [false true]))))
2327

24-
(def fn-int? (-> (h/fn int?)
25-
(h/with-test-check-gen gen/nat)))
28+
(def ^{:doc "A model that matches and generates integers."}
29+
fn-int? (-> (h/fn int?)
30+
(h/with-test-check-gen gen/nat)))
2631

27-
(def fn-double? (-> (h/fn double?)
28-
(h/with-test-check-gen gen/double)))
32+
(def ^{:doc "A model that matches and generates doubles."}
33+
fn-double? (-> (h/fn double?)
34+
(h/with-test-check-gen gen/double)))
2935

30-
(def fn-number? (-> (h/fn number?)
31-
(h/with-test-check-gen (gen/one-of [gen/nat gen/double]))))
36+
(def ^{:doc "A model that matches any number and generates intergers and doubles."}
37+
fn-number? (-> (h/fn number?)
38+
(h/with-test-check-gen (gen/one-of [gen/nat gen/double]))))
3239

33-
(def fn-string? (-> (h/fn string?)
34-
(h/with-test-check-gen gen/string-alphanumeric)))
40+
(def ^{:doc "A model that matches strings and generates alphanumeric strings."}
41+
fn-string? (-> (h/fn string?)
42+
(h/with-test-check-gen gen/string-alphanumeric)))
3543

36-
(def fn-symbol? (-> (h/fn symbol?)
37-
(h/with-test-check-gen gen/symbol)))
44+
(def ^{:doc "A model that matches and generates symbols."}
45+
fn-symbol? (-> (h/fn symbol?)
46+
(h/with-test-check-gen gen/symbol)))
3847

39-
(def fn-keyword? (-> (h/fn keyword?)
40-
(h/with-test-check-gen gen/keyword)))
48+
(def ^{:doc "A model that matches and generates keywords."}
49+
fn-keyword? (-> (h/fn keyword?)
50+
(h/with-test-check-gen gen/keyword)))
4151

42-
(def fn-keyword-ns? (-> (h/fn keyword?)
43-
(h/with-test-check-gen gen/keyword-ns)))
52+
(def ^{:doc "A model that matches keywords and generates keywords with a namespace."}
53+
fn-keyword-ns? (-> (h/fn keyword?)
54+
(h/with-test-check-gen gen/keyword-ns)))
4455

4556

4657

@@ -54,7 +65,7 @@
5465
(recur (dec index) (next elements)))))))
5566

5667
;; TODO: walk on :count-model and :condition-model nodes
57-
(defn postwalk [model visitor]
68+
(defn ^:no-doc postwalk [model visitor]
5869
(let [walk (fn walk [[stack walked-bindings] model path]
5970
(let [[[stack walked-bindings] model]
6071
(case (:type model)
@@ -113,7 +124,7 @@
113124
:fn (:min-value count-model)
114125
nil)))))
115126

116-
(defn assoc-leaf-distance-visitor
127+
(defn ^:no-doc assoc-leaf-distance-visitor
117128
"Associate an 'distance to leaf' measure to each node of the model.
118129
It is used as a hint on which path to choose when running out of budget
119130
in a budget-based data generation. It's very useful as well to avoid
@@ -154,7 +165,7 @@
154165
(cond-> model
155166
(some? distance) (assoc ::leaf-distance distance))))
156167

157-
(defn assoc-min-cost-visitor
168+
(defn ^:no-doc assoc-min-cost-visitor
158169
"Associate an 'minimun cost' measure to each node of the model.
159170
It is used as a hint during the budget-based data generation."
160171
[model stack path]

src/minimallist/util.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(ns minimallist.util
1+
(ns ^:no-doc minimallist.util
22
(:require [clojure.set :as set]
33
[clojure.walk :as walk]))
44

0 commit comments

Comments
 (0)