Skip to content

Commit 582ade9

Browse files
authored
Merge pull request #1046 from metosin/0.15.1
0.16.0
2 parents 32cc8c6 + 5583c27 commit 582ade9

File tree

12 files changed

+77
-66
lines changed

12 files changed

+77
-66
lines changed

.github/workflows/clojure.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
# Supported Java versions: LTS releases and latest
15-
jdk: [8, 11, 17, 21]
15+
jdk: [11, 17, 21]
1616
clojure: [11]
1717

1818
name: Clojure ${{ matrix.clojure }} (Java ${{ matrix.jdk }})
@@ -26,7 +26,7 @@ jobs:
2626
with:
2727
distribution: zulu
2828
java-version: ${{ matrix.jdk }}
29-
- uses: actions/cache@v3
29+
- uses: actions/cache@v4
3030
with:
3131
path: |
3232
~/.m2/repository
@@ -56,7 +56,7 @@ jobs:
5656
with:
5757
distribution: zulu
5858
java-version: 11
59-
- uses: actions/cache@v3
59+
- uses: actions/cache@v4
6060
with:
6161
path: |
6262
~/.m2/repository
@@ -88,7 +88,7 @@ jobs:
8888
with:
8989
distribution: zulu
9090
java-version: 11
91-
- uses: actions/cache@v3
91+
- uses: actions/cache@v4
9292
with:
9393
path: |
9494
~/.m2/repository

CHANGELOG.md

+18-6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ We use [Break Versioning][breakver]. The version numbers follow a `<major>.<mino
1414

1515
Malli is in well matured [alpha](README.md#alpha).
1616

17+
## 0.16.0 (2024-04-20)
18+
19+
* **BREAKING**: minimum Java-version is now Java11
20+
* allow changing prefix of json-schema $refs via option `:malli.json-schema/definitions-path` [#1045](https://github.com/metosin/malli/pull/1045)
21+
* Inline refs in non-`:body` swagger parameters [#1044](https://github.com/metosin/malli/pull/1044)
22+
* Fix flaky test [#1040](https://github.com/metosin/malli/pull/1040)
23+
* Utility to update entry properties: `mu/update-entry-properties` [#1037](https://github.com/metosin/malli/pull/1037)
24+
* Fix actions cache [#1036](https://github.com/metosin/malli/pull/1036)
25+
* Only humanize one of `:min` / `:max` when different [#1032](https://github.com/metosin/malli/pull/1032)
26+
* Distinguish between symbols and strings in humanize [#1031](https://github.com/metosin/malli/pull/1031)
27+
* Fix `:map-of` `:min` and unreachable generator, explain such-that failures [#1029](https://github.com/metosin/malli/pull/1029)
28+
1729
## 0.15.0 (2024-03-23)
1830

1931
* `:=>` takes optional 3rd child, the guard schema validating vector of arguments and return value `[args ret]`. See [Function Guards](docs/function-schemas.md#function-guards) for more details. Fixes [#764](https://github.com/metosin/malli/issues/764) and [#764](https://github.com/metosin/malli/issues/764).
@@ -561,14 +573,14 @@ No need to play with Compiler options or JVM properties to swap the default regi
561573

562574
;; look ma, just works
563575
(mr/set-default-registry!
564-
(mr/composite-registry
565-
(m/default-schemas)
566-
(mu/schemas)))
576+
(mr/composite-registry
577+
(m/default-schemas)
578+
(mu/schemas)))
567579

568580
(mg/generate
569-
[:merge
570-
[:map [:x :int]]
571-
[:map [:y :int]]])
581+
[:merge
582+
[:map [:x :int]]
583+
[:map [:y :int]]])
572584
; => {:x 0, :y 92}
573585
```
574586

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ So, we decided to spin out our own library, which would do all the things we fee
6868

6969
[![Clojars Project](http://clojars.org/metosin/malli/latest-version.svg)](http://clojars.org/metosin/malli)
7070

71-
Malli requires Clojure 1.11.
71+
Malli requires Java 11 and Clojure 1.11.
7272

7373
## Quickstart
7474

deps.edn

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
mvxcvi/arrangement {:mvn/version "2.1.0"}}
99
:aliases {:test {:extra-paths ["test"]
1010
:extra-deps {com.gfredericks/test.chuck {:mvn/version "0.2.14"}
11-
lambdaisland/kaocha {:mvn/version "1.87.1366"}
11+
lambdaisland/kaocha {:mvn/version "1.88.1376"}
1212
lambdaisland/kaocha-cljs {:mvn/version "1.5.154"}
1313
org.babashka/sci {:mvn/version "0.8.41"}
1414
lambdaisland/kaocha-junit-xml {:mvn/version "1.17.101"}
@@ -19,7 +19,7 @@
1919
prismatic/schema {:mvn/version "1.4.1"}
2020
minimallist/minimallist {:mvn/version "0.0.10"}
2121
net.cgrand/seqexp {:mvn/version "0.6.2"}
22-
djblue/portal {:mvn/version "0.53.0"}
22+
djblue/portal {:mvn/version "0.55.1"}
2323
meta-merge/meta-merge {:mvn/version "1.0.0"}
2424
expound/expound {:mvn/version "0.9.0"}
2525
lambdaisland/deep-diff {:mvn/version "0.0-47"}
@@ -49,7 +49,7 @@
4949
org.clojure/tools.namespace #_:clj-kondo/ignore {:mvn/version "RELEASE"}}}
5050

5151
:shadow {:extra-paths ["app"]
52-
:extra-deps {thheller/shadow-cljs {:mvn/version "2.28.2"}
52+
:extra-deps {thheller/shadow-cljs {:mvn/version "2.28.3"}
5353
binaryage/devtools {:mvn/version "1.0.7"}}}
5454
:slow {:extra-deps {io.dominic/slow-namespace-clj
5555
{:git/url "https://git.sr.ht/~severeoverfl0w/slow-namespace-clj"

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>metosin</groupId>
55
<artifactId>malli</artifactId>
6-
<version>0.15.0</version>
6+
<version>0.16.0</version>
77
<name>malli</name>
88
<licenses>
99
<license>
@@ -15,7 +15,7 @@
1515
<url>https://github.com/metosin/malli</url>
1616
<connection>scm:git:git://github.com/metosin/malli.git</connection>
1717
<developerConnection>scm:git:ssh://[email protected]/metosin/malli.git</developerConnection>
18-
<tag>0.15.0</tag>
18+
<tag>0.16.0</tag>
1919
</scm>
2020
<dependencies>
2121
<dependency>

src/malli/clj_kondo.cljc

+4-4
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@
129129
{:op :rest :spec child}
130130
:seqable))
131131

132-
(defmethod accept :+ [_ _ children options] (-seqable-or-rest children options))
133-
(defmethod accept :* [_ _ children options] (-seqable-or-rest children options))
134-
(defmethod accept :? [_ _ children options] (-seqable-or-rest children options))
135-
(defmethod accept :repeat [_ _ children options] (-seqable-or-rest children options))
132+
(defmethod accept :+ [_ _ children options] (-seqable-or-rest children options))
133+
(defmethod accept :* [_ _ children options] (-seqable-or-rest children options))
134+
(defmethod accept :? [_ _ children options] (-seqable-or-rest children options))
135+
(defmethod accept :repeat [_ _ children options] (-seqable-or-rest children options))
136136

137137
(defmethod accept :cat [_ _ children _] children)
138138
(defmethod accept :catn [_ _ children _] (mapv last children))

src/malli/core.cljc

+2-1
Original file line numberDiff line numberDiff line change
@@ -2366,7 +2366,8 @@
23662366

23672367
(defn -default-sci-options []
23682368
{:preset :termination-safe
2369-
:aliases {'str 'clojure.string}
2369+
:aliases {'str 'clojure.string
2370+
'm 'malli.core}
23702371
:namespaces {'malli.core {'properties properties
23712372
'type type
23722373
'children children

src/malli/error.cljc

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
[malli.core :as m]
44
[malli.util :as mu]))
55

6-
(defn- -pr-str [v]
7-
#?(:clj (pr-str v)
8-
:cljs (str v)))
6+
(defn -pr-str [v] #?(:clj (pr-str v), :cljs (str v)))
97

108
(defn -pred-min-max-error-fn [{:keys [pred message]}]
119
(fn [{:keys [schema value]} _]

src/malli/experimental/time.cljc

+14-14
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
"Periods are not comparable in the java Comparable sense, instead this performs simple units-by-units comparison.
3434
So a period of 1 year will always compare greater than a period of 13 months and similar for days and months."
3535
[^Period p1 ^Period p2]
36-
(let [years1 #?(:clj (.getYears p1) :cljs (.years p1))
37-
years2 #?(:clj (.getYears p2) :cljs (.years p2))
36+
(let [years1 #?(:clj (.getYears p1) :cljs (.years p1))
37+
years2 #?(:clj (.getYears p2) :cljs (.years p2))
3838
months1 #?(:clj (.getMonths p1) :cljs (.months p1))
3939
months2 #?(:clj (.getMonths p2) :cljs (.months p2))
40-
days1 #?(:clj (.getDays p1) :cljs (.days p1))
41-
days2 #?(:clj (.getDays p2) :cljs (.days p2))]
40+
days1 #?(:clj (.getDays p1) :cljs (.days p1))
41+
days2 #?(:clj (.getDays p2) :cljs (.days p2))]
4242
(cond
4343
(not (= years1 years2)) (- years1 years2)
4444
(not (= months1 months2)) (- months1 months2)
@@ -52,8 +52,8 @@
5252
(if (and (instance? Period min) (instance? Period max))
5353
(fn [^Period x]
5454
(and
55-
(not (pos? (compare-periods x max)))
56-
(not (pos? (compare-periods min x)))))
55+
(not (pos? (compare-periods x max)))
56+
(not (pos? (compare-periods min x)))))
5757
(fn [x] (and (<= x max) (<= min x))))
5858
min (fn [x]
5959
(if (instance? Period min)
@@ -66,14 +66,14 @@
6666

6767
(defn -temporal-schema [{:keys [type class type-properties]}]
6868
(m/-simple-schema
69-
(cond->
70-
{:type type
71-
:pred (fn pred [x]
72-
#?(:clj (.isInstance ^Class class x)
73-
:cljs (instance? class x)))
74-
:property-pred (-min-max-pred nil)}
75-
type-properties
76-
(assoc :type-properties type-properties))))
69+
(cond->
70+
{:type type
71+
:pred (fn pred [x]
72+
#?(:clj (.isInstance ^Class class x)
73+
:cljs (instance? class x)))
74+
:property-pred (-min-max-pred nil)}
75+
type-properties
76+
(assoc :type-properties type-properties))))
7777

7878
#?(:cljs
7979
(defn createTemporalQuery [f]

src/malli/experimental/time/generator.cljc

+12-12
Original file line numberDiff line numberDiff line change
@@ -135,22 +135,22 @@
135135
floor-min (fn [v] (if (nil? v) min-int (max min-int v)))
136136
{^Period mn :min ^Period mx :max ^Period gen-min :gen/min ^Period gen-max :gen/max}
137137
(merge
138-
(m/type-properties schema options)
139-
(m/properties schema options))
138+
(m/type-properties schema options)
139+
(m/properties schema options))
140140
_ (when (and mn gen-min (not (pos? (time/compare-periods gen-min min))))
141141
(m/-fail! ::mg/invalid-property {:key :gen/min, :value gen-min, :min min}))
142-
_ (when (and mx gen-max (not (pos? (time/compare-periods max gen-max))))
142+
_ (when (and mx gen-max (not (pos? (time/compare-periods max gen-max))))
143143
(m/-fail! ::mg/invalid-property {:key :gen/max, :value gen-min, :max min}))
144144
mn (or mn gen-min)
145145
mx (or mx gen-max)
146-
min-years (when mn (zero->nil (.getYears mn))), max-years (when mx (zero->nil (.getYears mx)))
146+
min-years (when mn (zero->nil (.getYears mn))), max-years (when mx (zero->nil (.getYears mx)))
147147
min-months (when mn (zero->nil (.getMonths mn))), max-months (when mx (zero->nil (.getMonths mx)))
148-
min-days (when mn (zero->nil (.getDays mn))), max-days (when mx (zero->nil (.getDays mx)))]
148+
min-days (when mn (zero->nil (.getDays mn))), max-days (when mx (zero->nil (.getDays mx)))]
149149
(->>
150-
(gen/tuple
151-
;; Period constructor only accepts java type `int` not `long`, clamp the values
152-
(gen/large-integer* {:min (floor-min min-years) :max (ceil-max max-years)})
153-
(gen/large-integer* {:min (floor-min min-months) :max (ceil-max max-months)})
154-
(gen/large-integer* {:min (floor-min min-days) :max (ceil-max max-days)}))
155-
(gen/fmap (fn [[years months days]]
156-
(. Period of years months days))))))
150+
(gen/tuple
151+
;; Period constructor only accepts java type `int` not `long`, clamp the values
152+
(gen/large-integer* {:min (floor-min min-years) :max (ceil-max max-years)})
153+
(gen/large-integer* {:min (floor-min min-months) :max (ceil-max max-months)})
154+
(gen/large-integer* {:min (floor-min min-days) :max (ceil-max max-days)}))
155+
(gen/fmap (fn [[years months days]]
156+
(. Period of years months days))))))

src/malli/transform.cljc

+7-7
Original file line numberDiff line numberDiff line change
@@ -399,15 +399,15 @@
399399
strip-map-of (fn [stage]
400400
{:compile (fn [schema options]
401401
(let [entry-schema (m/into-schema :tuple nil (m/children schema) options)
402-
valid? (m/validator entry-schema options)]
402+
valid? (m/validator entry-schema options)]
403403
{stage (fn [x]
404-
(reduce (fn [acc entry]
405-
(if (valid? entry)
406-
(apply assoc acc entry)
407-
acc)) (empty x) x))}))})]
404+
(reduce (fn [acc entry]
405+
(if (valid? entry)
406+
(apply assoc acc entry)
407+
acc)) (empty x) x))}))})]
408408
(transformer
409-
{:decoders {:map strip-map, :map-of (strip-map-of :leave)}
410-
:encoders {:map strip-map, :map-of (strip-map-of :enter)}}))))
409+
{:decoders {:map strip-map, :map-of (strip-map-of :leave)}
410+
:encoders {:map strip-map, :map-of (strip-map-of :enter)}}))))
411411

412412
(defn key-transformer [{:keys [decode encode types] :or {types #{:map}}}]
413413
(let [transform (fn [f stage] (when f {stage (-transform-map-keys f)}))]

test/malli/core_test.cljc

+9-9
Original file line numberDiff line numberDiff line change
@@ -2426,13 +2426,13 @@
24262426
(is (nil? (explain-times function-schema-validation-times schema2 (fn [x y] (unchecked-add x y)))))
24272427

24282428
(testing "exception in execution causes single error to root schema path"
2429-
(is (results= {:schema [:=> [:cat int? int?] int?]
2430-
:value single-arity
2431-
:errors [{:path []
2432-
:in []
2433-
:schema [:=> [:cat int? int?] int?]
2434-
:value single-arity}]}
2435-
(m/explain schema2 single-arity))))
2429+
(is (results= {:schema [:=> [:cat int? int?] int?]
2430+
:value single-arity
2431+
:errors [{:path []
2432+
:in []
2433+
:schema [:=> [:cat int? int?] int?]
2434+
:value single-arity}]}
2435+
(m/explain schema2 single-arity))))
24362436

24372437
(testing "error in output adds error to child in path 1"
24382438
(let [f (fn [x y] (str x y))]
@@ -2527,15 +2527,15 @@
25272527
(testing "guards"
25282528
(let [guard (fn [[[x y] z]] (= (str x y) z))
25292529
schema (m/schema
2530-
[:=> [:cat :int :int] string? [:fn guard]]
2530+
[:=> [:cat :int :int] :string [:fn guard]]
25312531
{::m/function-checker mg/function-checker})
25322532
valid (fn [x y] (str x y))
25332533
invalid (fn [x y] (str x "-" y))]
25342534

25352535
(is (= {:type :=>,
25362536
:input {:type :cat
25372537
:children [{:type :int} {:type :int}]},
2538-
:output {:type 'string?},
2538+
:output {:type :string},
25392539
:guard {:type :fn
25402540
:value guard}}
25412541
(m/ast schema)))

0 commit comments

Comments
 (0)