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

Add circe module #458

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ lazy val root = (project in file(".")
settings commonSettings
settings (publish / skip := true)
settings (alias)
aggregate (skafka, `play-json`, metrics, tests))
aggregate (skafka, `play-json`, circe, metrics, tests))

lazy val skafka = (project in file("skafka")
settings commonSettings
Expand Down Expand Up @@ -89,6 +89,12 @@ lazy val `play-json` = (project in file("modules/play-json")
dependsOn skafka
settings (libraryDependencies ++= Seq(Dependencies.`play-json-jsoniter`, scalatest % Test)))

lazy val circe = (project in file("modules/circe")
settings (name := "skafka-circe")
settings commonSettings
dependsOn skafka
settings (libraryDependencies += Dependencies.circe))

lazy val metrics = (project in file("modules/metrics")
settings (name := "skafka-metrics")
settings commonSettings
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.evolutiongaming.skafka.circe

import com.evolutiongaming.catshelper.FromTry
import com.evolutiongaming.skafka.ToBytes
import io.circe.Encoder
import cats.syntax.contravariant.toContravariantOps
import io.circe.syntax.EncoderOps

object ToBytesFromEncoder {
def apply[F[_]: FromTry, A: Encoder]: ToBytes[F, A] = ToBytes.stringToBytes[F].contramap(_.asJson.noSpaces)
}
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ object Dependencies {
val `cats-helper` = "com.evolutiongaming" %% "cats-helper" % "3.11.0"
val `testcontainers-kafka` = "com.dimafeng" %% "testcontainers-scala-kafka" % "0.41.0"
val `play-json-jsoniter` = "com.evolution" %% "play-json-jsoniter" % "1.1.1"
val circe = "io.circe" %% "circe-core" % "0.14.10"
val `scala-java8-compat` = "org.scala-lang.modules" %% "scala-java8-compat" % "1.0.2"
val `collection-compat` = "org.scala-lang.modules" %% "scala-collection-compat" % "2.11.0"
val scalatest = "org.scalatest" %% "scalatest" % "3.2.17"
Expand Down