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

[0.2.0] allow configuration of nested products/coproducts #74

Closed
arainko opened this issue Jul 26, 2023 · 0 comments
Closed

[0.2.0] allow configuration of nested products/coproducts #74

arainko opened this issue Jul 26, 2023 · 0 comments

Comments

@arainko
Copy link
Owner

arainko commented Jul 26, 2023

So currently ducktape is only able to configure fields/cases of the top-level entity it operates on eg.

case class Person(name: String, address: Address)
case class Address(city: String)

so let's imagine that we want to transform Person into something else but the fields in the Address case class don't quite align. In ducktape 0.1.x to configure fields of the Address field we'd have to do a lot of gymnastics (a separate and explicit Transformer for Address -> DestTyle, an ugly transformation in Field.computed(_.address, _.address.into[DestType]...), generally it is not a good experience.

In ducktape 0.2.x we should be able to just do

Field.computed(_.address.city, _.doWhateverYouNeedToDoHere)

What's more we should also be able to configure fields inside coproduct cases with something like:

Field.computed(_.someCoproduct.at[SomeCoproduct.Case1].field1, _.doSomethingHere)

or even configure cases themselves with

Case.const(_.someCoproduct.at[SomeCoproduct.Case1], SomeCoproduct.Case1(12345))

that'd also mean 0.2.x should deprecate the old way of configuring Cases (but still keep them for sourcecompat until at least 0.3.x)

@arainko arainko added this to the ducktape 0.2.0 milestone Jul 26, 2023
arainko added a commit that referenced this issue Dec 1, 2023
@arainko arainko closed this as completed Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant