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

Transformation returning Validated/Either/... #118

Closed
sideeffffect opened this issue Oct 11, 2019 · 2 comments · Fixed by #146
Closed

Transformation returning Validated/Either/... #118

sideeffffect opened this issue Oct 11, 2019 · 2 comments · Fixed by #146

Comments

@sideeffffect
Copy link

sideeffffect commented Oct 11, 2019

Would it be possible to have a slightly different variant of TransformerInto.enableUnsafeOption, which instead of throwing exceptions would return a value, like cats.data.Validated (or something analogous, like Either).

Our use case is that we would like to convert ScalaPB generated case classes (where everything is Optional) to our domain case classes where some fields are mandatory. It would help us a lot, if the convertor method returned just a plain value (Validated, Either,...) instead of throwing and us having to catch the exceptions.

It would behave similar to henkan which also has validate method to return cats.data.Validated.

@krzemin krzemin linked a pull request Feb 18, 2020 that will close this issue
@MateuszKubuszok
Copy link
Member

#146 implements what you described, but before we decide to merge and release it, it would be good if more eyes looked at it and maybe tested their use cases.

@MateuszKubuszok
Copy link
Member

Feature released in 0.5.0, available on OSS Sonatype, should appear on Maven soon.

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 a pull request may close this issue.

2 participants