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

Deprecate Validated #2940

Merged
merged 9 commits into from
Mar 1, 2023
Merged

Deprecate Validated #2940

merged 9 commits into from
Mar 1, 2023

Conversation

nomisRev
Copy link
Member

@nomisRev nomisRev commented Feb 22, 2023

Suggested migration process using ReplaceWith:

  • Migrate all methods, zip -> zipOrAccumulate, getOrElse, etc to their toEither() equivalents using Replace in entire project action from IntelliJ
  • Migrate all functions returning Validated or ValidatedNel, and their invalid, invalidNel(), etc constructors. (This piece can potentially be scripted like https://gist.github.com/nomisRev/e01ddc354c84b8b626c23d024706b916)
  • Replace in entire project Either.toEither() intermediate method

=> Now all Validated usage should be somewhat automatically be replaced in the project in 3~4 steps.
Refactoring looks like this:

Validated.Refactor.2.mov

Issues:

  • For some reason typealias ValidatedNel doesn't add the import
  • toValidated is unresolved after the refactor. We could remove it from ReplaceWith, making it an incorrect replacement. Then we might also consider removing the intermediate calls to toEither()`.

Separately also investigating if we can automate this further using OpenRewrite to offer a smooth and pain-free migration process.

@nomisRev nomisRev requested review from serras, raulraja, franciscodr and a team February 22, 2023 11:27
@github-actions
Copy link
Contributor

github-actions bot commented Feb 22, 2023

@nomisRev nomisRev marked this pull request as ready for review February 22, 2023 19:05
@serras
Copy link
Member

serras commented Feb 23, 2023

Awesome dev experience :)

@nomisRev
Copy link
Member Author

nomisRev commented Feb 23, 2023

cc\ @Zordid

This PR changes E.toEitherNel to E.leftNel as you reported.

@nomisRev
Copy link
Member Author

Ooof, thanks @franciscodr! Bunch of copy-paste mistakes 🙈

franciscodr and others added 2 commits February 24, 2023 12:13
@nomisRev nomisRev mentioned this pull request Feb 24, 2023
14 tasks
@nomisRev
Copy link
Member Author

nomisRev commented Mar 1, 2023

Any feedback, or comments on the PR still very welcome 🙏 Thank you ☺️

@nomisRev nomisRev merged commit 8e0121a into main Mar 1, 2023
@nomisRev nomisRev deleted the sv-validated-deprecation branch March 1, 2023 16:01
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.

4 participants