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

Programming with Schemas, part1 #45

Closed
ikitommi opened this issue Aug 22, 2019 · 1 comment · Fixed by #62
Closed

Programming with Schemas, part1 #45

ikitommi opened this issue Aug 22, 2019 · 1 comment · Fixed by #62
Assignees
Labels
enhancement New feature or request for discussion Discussion is main focus of PR

Comments

@ikitommi
Copy link
Member

ikitommi commented Aug 22, 2019

Programming schemas should be first-class. schema-tools is a good example of a great library in this space. We could start with m/merge which does potetially lossy merge like the clojure.core/merge does.

Default (overwriting keys):

(m/merge
  [:map
   [:x int?]
   [:y int?]]
  [:map
   [:x int?]
   [:y {:optional true} string?]]
  {:strategy :overwrite})
; [:map
;  [:x int?]
;  [:y {:optional true} string?]]

Compose leaves:

(m/merge
  [:map
   [:x int?]
   [:y int?]]
  [:map
   [:x int?]
   [:y {:optional true} string?]]
  {:strategy :merge})
; [:map
;  [:x int?]
;  [:y [:or int? string?]]]

Needs some discussion how to do this right.

Related: #37

@ikitommi ikitommi added enhancement New feature or request for discussion Discussion is main focus of PR labels Aug 22, 2019
@ikitommi
Copy link
Member Author

Could we use meta-merge semantics here for finer-grained control on how to do things?

@ikitommi ikitommi self-assigned this Sep 7, 2019
This was referenced Sep 8, 2019
@ikitommi ikitommi changed the title Tools for programming with Schemas Programming with Schemas, part 1 Sep 8, 2019
@ikitommi ikitommi changed the title Programming with Schemas, part 1 Programming with Schemas, part1 Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request for discussion Discussion is main focus of PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant