【发布时间】:2021-12-25 20:59:22
【问题描述】:
我有一个 Scala 3 项目(3.0.0 版本),我正在尝试使用 http4s 构建简单的 Rest API。
我在解码/编码 JSON 时遇到问题。
我正在基于http4s.g8 构建我的代码。
问题出现在this line:
implicit val jokeDecoder: Decoder[Joke] = deriveDecoder[Joke]
编译错误:
在对象
semiauto中找不到方法deriveDecoder的参数A类型的隐式参数semiauto
Scala 3 是否有一些变化使其与众不同?
我的依赖
scalaVersion := "3.0.0"
val Http4sVersion = "0.23.6"
val CirceVersion = "0.14.1"
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-blaze-server" % Http4sVersion,
"org.http4s" %% "http4s-blaze-client" % Http4sVersion,
"org.http4s" %% "http4s-circe" % Http4sVersion,
"org.http4s" %% "http4s-dsl" % Http4sVersion,
"io.circe" %% "circe-core" % CirceVersion,
"io.circe" %% "circe-generic" % CirceVersion
)
【问题讨论】: