From 6d063cd94d8553073e768bb879a52c0b5dbc5061 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Tue, 8 Aug 2023 14:37:46 +0300 Subject: [PATCH 1/2] fix #925 --- src/malli/impl/regex.cljc | 2 +- test/malli/core_test.cljc | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/malli/impl/regex.cljc b/src/malli/impl/regex.cljc index 7730d029c..0096ee75b 100644 --- a/src/malli/impl/regex.cljc +++ b/src/malli/impl/regex.cljc @@ -192,7 +192,7 @@ :malli.core/invalid)))) (defn catn-unparser [& unparsers] - (let [unparsers (into {} unparsers)] + (let [unparsers (apply array-map (mapcat identity unparsers))] (fn [m] (if (and (map? m) (= (count m) (count unparsers))) (miu/-reduce-kv-valid (fn [coll tag unparser] diff --git a/test/malli/core_test.cljc b/test/malli/core_test.cljc index d283fde71..70b28e279 100644 --- a/test/malli/core_test.cljc +++ b/test/malli/core_test.cljc @@ -2959,3 +2959,18 @@ (prefixer "g") (prefixer "h") (prefixer "i")) "xxx")))))) + +(deftest -issue-925-test + (testing "order is retained with catn parse+unparse" + (let [schema [:catn + [:a :int] + [:b :int] + [:c :int] + [:d :int] + [:e :int] + [:f :int] + [:g :int] + [:h :int] + [:i :int]] + input [1 2 3 4 5 6 7 8 9]] + (is (= input (->> input (m/parse schema) (m/unparse schema))))))) From f86241a5ab6c73896b1c1eb12a875b76e6991b6d Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Tue, 8 Aug 2023 14:41:22 +0300 Subject: [PATCH 2/2] CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6af099328..c16f45a92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ We use [Break Versioning][breakver]. The version numbers follow a `.