Closed jahson closed 10 months ago
in https://github.com/metosin/malli/pull/871/commits/0e5b5e3ac56479f75c812c1320ac1f1ebfba8f76:
(testing "extra keys from :map are stripped"
(is (= {:x 1, :y 2}
(m/decode
[:map [:x :int] [:y :int]]
{:x 1, :y 2, :z 3}
(mt/strip-extra-keys-transformer)))))
so, this seems intentional, but should have been part of CHANGELOG as breaking.
not to strip keys, you can either:
;; explicitly open map
(m/decode
[:map {:closed false}]
{:x 1, :y 2, :z 3}
(mt/strip-extra-keys-transformer))
; => {:x 1, :y 2, :z 3}
or:
;; anything goes
(m/decode
[:map [::m/default :any]]
{:x 1, :y 2, :z 3}
(mt/strip-extra-keys-transformer))
; => {:x 1, :y 2, :z 3}
post-fixed the CHANGELOG for 0.10.3 for this:
https://github.com/metosin/malli/commit/e3631e4a4c9f8190c101d3d51967a53fc00815de & https://github.com/metosin/malli/commit/23f0c02d90115a96fda5c37a5cb2c7e32b75a60e
Hi! Today I've discovered that after 0.10.3
strip-extra-keys-transformer
changed its behavior:[metosin/malli "0.10.2"]
[metosin/malli "0.10.3"]
It is for sure related to https://github.com/metosin/malli/blob/master/CHANGELOG.md#0103-2023-03-18 and https://github.com/metosin/malli/pull/871