Skip to content

Nested map with invalid value breaks strip-extra-keys-transformer when using map-of #1118

@bgalartza

Description

@bgalartza

Apparently having a nested map with an invalid value inside map-of breaks the strip-extra-keys-transformer.

Works as expected:

(m/encode
 [:map-of
  :any
  [:map
   [:a
    [:string]]
   [:b
    [:string]]]]
 {"anything" {:a "a" :b "b" :c "c"}}
 mt/strip-extra-keys-transformer)
{"anything" {:a "a", :b "b"}

Produces empty map instead of {"anything" {:a "a"}}:

(m/encode
 [:map-of
  :any
  [:map
   [:a
    [:string]]
   [:b
    [:string]]]]
 {"anything" {:a "a" :c "c"}}
 mt/strip-extra-keys-transformer)
 {}

I found some mention to this problem in this pull request

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    👍 Could do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions