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

Improve implicit resolution of validated mapping #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

koshelev
Copy link
Contributor

No description provided.

@koshelev koshelev requested review from simao and houcros January 10, 2019 11:24
@simao
Copy link
Contributor

simao commented Jan 10, 2019

I think we should keep this separate. The problem is when you have multiple valid implicits, scala is not always smart enough to tell you there are too many and it cannot choose one. In the past, this led to cases where the app was using the wrong implicit.

For example, if there is a circe encoder for type T and a Validated mapper for type T, which should be used? there is a mapping for json types and there is a mapping for validated so..

@koshelev
Copy link
Contributor Author

this PR just get's rid of validatedStringMapper[T], so nothing changes in regards of your concerns. validatedStringMapper[T] should go away in any case.
It always makes sense to pass parameter explicitly in case there are multiple implicits for the same type. But it should not be a case for wrapper types anyway.


case class Book(id: Long, title: String, code: Option[String] = None)
case class Book(id: Long, title: BookTitle, code: Option[String] = None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems BookTitle is not defined?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a new commit with the definition.

Signed-off-by: Ignacio Lucero <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants