Skip to content

Change the API to be compatible with the upcoming Scala-3 v… #665

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

benko-ct
Copy link
Contributor

@benko-ct benko-ct commented May 8, 2025

…ersion (details in SCALA-3-MIGRATION-GUIDE.md)

…ersion (details in SCALA-3-MIGRATION-GUIDE.md)
@benko-ct benko-ct requested a review from yanns as a code owner May 8, 2025 15:25
@benko-ct benko-ct changed the title [BEC-870] Change the API to be compatible with the upcoming Scala-3 v… Change the API to be compatible with the upcoming Scala-3 v… May 8, 2025
List(SingletonMixed, RecordMixed(1)).foreach { m: Mixed =>
fromJSON[Mixed](toJSON(m)) must equal(Valid(m))
}
}

it("must provide derived instances for scala.Enumeration") {
implicit val scalaEnumJSON = deriveJSON[ScalaEnum.Value]
implicit val scalaEnumJSON: JSON[JSONSpec.ScalaEnum.Value] = jsonEnum(ScalaEnum)
Copy link
Contributor

Choose a reason for hiding this comment

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

We cannot use deriveJSON here?

Copy link
Contributor Author

@benko-ct benko-ct May 9, 2025

Choose a reason for hiding this comment

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

Enumerations have a fixed implementation, we don't need to "derive" anything, so I didn't add them to the scala-3 deriveJSON. The code is simpler this way.
If you think it's better to have everything under deriveJSON, I can add it to the scala-3 implementation.

Copy link
Contributor

Choose a reason for hiding this comment

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

As we have deriveJSON for enums in scala 2, it would be nice to have the same in scala 3, unless this is too much work. I let you judge here.

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