Skip to content

Commit

Permalink
Switching over to pekko-http
Browse files Browse the repository at this point in the history
  • Loading branch information
blast-hardcheese committed Dec 14, 2023
1 parent 482bada commit 6e4a91c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
28 changes: 13 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Compile / guardrailTasks := List(
ScalaServer(file("petstore.yaml"), pkg="foo"),
ScalaServer(file("petstore.yaml"), pkg="foo", modules=List("pekko-http", "circe")),
)

val akkaVersion = "2.6.15"
val akkaHttpVersion = "10.2.4"
val pekkoVersion = "1.0.0"
val pekkoHttpVersion = "1.0.0"
val catsVersion = "2.6.1"
val circeVersion = "0.14.1"
val scalatestVersion = "3.2.9"
Expand All @@ -14,16 +14,14 @@ scalacOptions ++= Seq("-Ypartial-unification", "-deprecation")
libraryDependencies += "org.slf4j" % "slf4j-simple" % "1.7.30"

libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"javax.xml.bind" % "jaxb-api" % jaxbApiVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.typelevel" %% "cats-core" % catsVersion,
"org.apache.pekko" %% "pekko-http" % pekkoHttpVersion,
"org.apache.pekko" %% "pekko-http-testkit" % pekkoHttpVersion,
"org.apache.pekko" %% "pekko-stream" % pekkoVersion,
"org.apache.pekko" %% "pekko-testkit" % pekkoVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"javax.xml.bind" % "jaxb-api" % jaxbApiVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.typelevel" %% "cats-core" % catsVersion,
)

addCompilerPlugin(scalafixSemanticdb)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.5.2
sbt.version=1.9.7
10 changes: 9 additions & 1 deletion project/guardrail.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
addSbtPlugin("com.twilio" % "sbt-guardrail" % "0.64.0")
addSbtPlugin("dev.guardrail" % "sbt-guardrail" % "1.0.0-SNAPSHOT")

libraryDependencies ++= Seq(
"dev.guardrail" %% "guardrail-scala-pekko-http" % "0.1.0-SNAPSHOT",
"dev.guardrail" %% "guardrail-core" % "1.0.0-SNAPSHOT",
"dev.guardrail" %% "guardrail-scala-support" % "1.0.0-SNAPSHOT",
)

resolvers += "Sonatype OSS Snapshots" at "https://s01.oss.sonatype.org/content/repositories/snapshots"
8 changes: 4 additions & 4 deletions src/main/scala/App.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent._
import scala.concurrent.duration.Duration

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.ContentType
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model.ContentType

import foo.pet._
import foo.definitions.Pet
Expand Down Expand Up @@ -32,7 +32,7 @@ object App extends App {

override def updatePet(respond: PetResource.UpdatePetResponse.type)(name: String, body: Option[Pet]): Future[PetResource.UpdatePetResponse] = ???

def getPets(respond: PetResource.GetPetsResponse.type)(name: Iterable[String], status: Option[String]) = ???
def getPets(respond: PetResource.GetPetsResponse.type)(name: Vector[String], status: Option[String]) = ???
})

Await.result(Http().newServerAt("127.0.0.1", 8080).bindFlow(routes), Duration.Inf)
Expand Down

0 comments on commit 6e4a91c

Please sign in to comment.