Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -walk option to inherit ::val properties #1091

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants