dry-rb / dry-types

Flexible type system for Ruby with coercions and constraints
https://dry-rb.org/gems/dry-types
MIT License
860 stars 134 forks source link

Add `Dry::Types::Hash::Schema.merge` #381

Closed waiting-for-dev closed 4 years ago

waiting-for-dev commented 4 years ago

It's also aliased as .compose.

I submit this PR in relation with https://github.com/dry-rb/dry-struct/pull/139

It moves composition to the fundamental piece of a Dry::Struct, a Dry::Types::Hash::Schema.

If this PR is accepted I'll modify the other one accordingly so it makes use of the new method.

Key transformation and type transformation work in a different way due to how they are implemented, but I haven't studied why it is this way. Any feedback is welcomed :)

waiting-for-dev commented 4 years ago

Hey @solnic, a downside of this automation of Codacy you added is that its notifications come with your name (and so, consequently, the notification emails)... This way it is easy to miss a more personalized and important message written by you (as probably people will let automatic code review messages for later)

solnic commented 4 years ago

Hey @solnic, a downside of this automation of Codacy you added is that its notifications come with your name (and so, consequently, the notification emails)... This way it is easy to miss a more personalized and important message written by you (as probably people will let automatic code review messages for later)

that's not good. I'll see if this can be changed, if not - we'll go back to houndci.

solnic commented 4 years ago

@waiting-for-dev could you rebase this on top of master please?

solnic commented 4 years ago

@waiting-for-dev I disabled codeclimate and houndci and I also configured dry-bot to be the author of codacy comments. We'll see how that works once you push something new here 😄

waiting-for-dev commented 4 years ago

@solnic I rebased to master and fixed two issues I introduced by mistake.

Yep! Codacy is now much helpful :smiley:

flash-gordon commented 4 years ago

@waiting-for-dev oh, hold on a sec. We have Schema#schema already, we should just call schema(other.keys) in merge. WDYT?

waiting-for-dev commented 4 years ago

Thanks for your review @flash-gordon , I forced a new push