Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@frenchy64
Copy link
Collaborator

@frenchy64 frenchy64 commented Aug 16, 2024

Problem: during a -walk, it's useful for the props of ::val nodes to be inherited by the :map/:or/:multi entry. Currently this is difficult to implement.

This simplifies walk-properties in the documentation, but I'm not sure it's airtight enough to release as more than a suggestion.

I considered reusing ::walk-entry-vals but it could be a breaking change.

@ikitommi
Copy link
Member

ikitommi commented Aug 27, 2024

Had to revisit how the entry walking works, this is not good:

(defn walk [schema]
  (m/walk
   schema
   (m/schema-walker identity)
   {::m/walk-entry-vals true}))

(-> [:map [:x :int]] (walk) (walk) (walk))
; [:map [:x [:malli.core/val [:malli.core/val [:malli.core/val :int]]]]]

I guess the right thing to do would be to do automatically the opposite unwrapping somewhere. Where? in the m/schema-walker?

@frenchy64
Copy link
Collaborator Author

I guess the right thing to do would be to do automatically the opposite unwrapping somewhere.

Yes, I noticed the same thing.

Where? in the m/schema-walker?

I think it would reasonable for -inner-entries to collapse any ::val schemas it finds on the way back up.

@ikitommi
Copy link
Member

I considered reusing ::walk-entry-vals but it could be a breaking change.

I think it's a bug that the entries are kept after walking, so it would be ok to to de-walk them using ::walk-entry-vals. It's a breaking change, but for the better.

@ikitommi ikitommi added the WIP work in progress, not ready yet label Mar 26, 2025
@frenchy64 frenchy64 marked this pull request as draft March 26, 2025 19:05
@mattiuusitalo mattiuusitalo moved this to 🇰‍🇼 Waiting in Metosin Open Source Backlog Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WIP work in progress, not ready yet

Projects

Status: ⌛Waiting

Development

Successfully merging this pull request may close these issues.

2 participants