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

Set Operations with (Map) Schemas #82

Open
ikitommi opened this issue Oct 7, 2019 · 2 comments
Open

Set Operations with (Map) Schemas #82

ikitommi opened this issue Oct 7, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@ikitommi
Copy link
Member

ikitommi commented Oct 7, 2019

Currently, we have m/merge. Instead, we should have malli.set with at least:

  • difference
  • intersection
  • union (the current m/merge)

should these also work with values? e.g:

(require '[malli.set :as ms])

(ms/difference [:map [:x int?] [:y int?]] {:x 1})
; => [:map [:y int?]]
@ikitommi ikitommi added the enhancement New feature or request label Oct 7, 2019
@esuomi
Copy link

esuomi commented Nov 28, 2019

Thinking out loud, while having them work with values in the way you show could be used for producing better error messages, malli already handles that part really well so it'd be overlapping functionality.

There also might be cases where it's somewhat ambiguous whether the second value is a schema or an actual value, as the projects I work with tend to have lookup maps from keywords to functions to enable certain dynamic behaviors, especially on frontend side. So maybe having it work with values would be a bit superfluous?

@ikitommi
Copy link
Member Author

ikitommi commented Jan 2, 2020

There is now separete malli.util/merge and malli.util/union.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants