Skip to content
New issue

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

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

Already on GitHub? # to your account

Add @Wrapper annotation #39

Open
alexarchambault opened this issue Nov 25, 2015 · 1 comment
Open

Add @Wrapper annotation #39

alexarchambault opened this issue Nov 25, 2015 · 1 comment

Comments

@alexarchambault
Copy link
Owner

To annotate case classes having a single field, like

@Wrapper case class Something(underlying: Underlying)

whose JSON representation is the one of the field.

Would avoid to write boilerplate like

case class Something(underlying: String)
object Something {
  implicit val decode = DecodeJson.of[Underlying].map(Something(_))
  implicit val encode = EncodeJson.of[Underlying].contramap[Something](_.underlying)
}

for simply

@Wrapper case class Something(underlying: Underlying)
@tylerjharden
Copy link

Maybe as a macro?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants