Skip to content

Possibly inconsistent keys between mu/keys and mu/assoc #1265

@vise890

Description

@vise890

Hi there, first of all thanks for the fantastic library!

We've noticed a possible inconsistency between the values returned by malli.util/keys and the ones taken by malli.util/assoc:

(def S [:map [[:foo] :any]])

(ma/validate S {[:foo] 1})
;; => true

(mu/keys S)
;; => ([:foo])

(mu/assoc S [:foo] :int)
;; => [:map [[:foo] :any] [:foo :int]]

;; I'd have expected the above to return:
;; => [:map [[:foo] :int]]

;; Looking at the implementation of malli.core/-set-entries, I see that I can force it with:
(mu/assoc S [[:foo]] :int)
;; => [:map [[:foo] :int]]

A similar behaviour can be observed with mu/assoc-in and :multi with dispatch values wrapped in vectors.

This is not super intuitive. Is this intended behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions