mar*_*tyn 1 scala http4s scala-3
我有一个 Scala 3 项目(3.0.0 版本),我正在尝试使用 http4s 构建简单的 Rest API。
我在解码/编码 JSON 时遇到问题。
我正在基于http4s.g8构建我的代码。
问题发生在这一行:
implicit val jokeDecoder: Decoder[Joke] = deriveDecoder[Joke]
Run Code Online (Sandbox Code Playgroud)
编译错误:
没有为对象中方法的
deriving.Mirror.Of[com.example.quickstart.Jokes.Joke]参数找到类型的隐式参数AderiveDecodersemiauto
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
)
Run Code Online (Sandbox Code Playgroud)
小智 6
final case class Joke(joke: String) extends AnyVal
Run Code Online (Sandbox Code Playgroud)
是铜。将其重写为
final case class Joke(joke: String)
Run Code Online (Sandbox Code Playgroud)
它应该有效
| 归档时间: |
|
| 查看次数: |
687 次 |
| 最近记录: |