Skip to content

Support for Play 3 #11

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

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Build and Test
strategy:
matrix:
scala: [2.12.13, 2.13.5]
scala: [2.13.14]

runs-on: ubuntu-latest
steps:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.8
java-version: adopt@1.11

- name: Cache sbt
uses: actions/cache@v2
Expand Down
12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ developers := List(
Developer(id = "Iterable", name = "Iterable", email = "[email protected]", url = url("https://iterable.com"))
)

scalaVersion := "2.13.5"
crossScalaVersions := Seq(scalaVersion.value, "2.12.13")
scalaVersion := "2.13.14"
crossScalaVersions := Seq(scalaVersion.value)

val PlayVersion = "2.8.6"
val PlayVersion = "3.0.1"

libraryDependencies ++= Seq(
// Play! framework
"com.typesafe.play" %% "play" % PlayVersion,
"com.typesafe.play" %% "play-joda-forms" % PlayVersion,
"org.playframework" %% "play" % PlayVersion,
"org.playframework" %% "play-joda-forms" % PlayVersion,
// dependencies for tests
"org.scalatest" %% "scalatest" % "3.2.5" % Test
"org.scalatest" %% "scalatest" % "3.2.18" % Test
)

parallelExecution in Test := false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ object CaseClassMapping extends Logging {
}

private def generateWrappedMappingForFormatter(fieldName: String, tpe: Type, formatter: Formatter[_]): Mapping[_] = {
val mapping = FieldMapping("")(formatter.asInstanceOf[Formatter[Any]])
@annotation.nowarn val mapping = FieldMapping("")(formatter.asInstanceOf[Formatter[Any]])
generateWrappedMappingForMapping(fieldName, tpe, mapping)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ import play.api.data.{Form, FormError, Mapping}

case class Baz(pls: String, work: Option[Long])
object Baz {
implicit val mapping = CaseClassMapping.mapping[Baz]
implicit val mapping: CaseClassMapping[Baz] = CaseClassMapping.mapping
}

case class Foo(a: String, omg: Option[Seq[Baz]])
object Foo {
implicit def mapping = CaseClassMapping.mapping[Foo]
implicit def mapping: CaseClassMapping[Foo] = CaseClassMapping.mapping
}

case class Bar(firstOne: Option[List[Long]], secondOne: String, third: Option[Foo], fourth: Option[Int]) extends UnbindableToWsRequest[Bar]
object Bar {
implicit val mapping = CaseClassMapping.mapping[Bar]
implicit val mapping: CaseClassMapping[Bar] = CaseClassMapping.mapping
}

class CaseClassMappingSpec extends AnyWordSpec with Matchers {
// TODO - it breaks on this, because
// scala.ScalaReflectionException: class Bar2 is an inner class, use reflectClass on an InstanceMirror to obtain its ClassMirror
case class Bar2(firstOne: Int)
object Bar2 {
implicit lazy val mapping = CaseClassMapping.mapping[Bar2]
implicit lazy val mapping: CaseClassMapping[Bar2] = CaseClassMapping.mapping
}

"CaseClassMapping" should {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.scalatest.wordspec.AnyWordSpec

case class User(name: String, age: Int, email: String, favoriteBands: Seq[String]) extends UnbindableToWsRequest[User]
object User {
implicit val mapping = CaseClassMapping.mapping[User]
implicit val mapping: CaseClassMapping[User] = CaseClassMapping.mapping
}

class UnbindableToWsRequestSpec extends AnyWordSpec with Matchers {
Expand Down
Loading