我有一個 Scala 3 專案(3.0.0 版本),我正在嘗試使用 http4s 構建簡單的 Rest API。
我在解碼/編碼 JSON 時遇到問題。
我正在基于http4s.g??8構建我的代碼。
問題發生在這一行:
implicit val jokeDecoder: Decoder[Joke] = deriveDecoder[Joke]
編譯錯誤:
未
deriving.Mirror.Of[com.example.quickstart.Jokes.Joke]找到物件A中方法引數的隱式引數型別deriveDecodersemiauto
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
)
uj5u.com熱心網友回復:
final case class Joke(joke: String) extends AnyVal
是丘位元。將其改寫為
final case class Joke(joke: String)
它應該作業
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/358558.html
下一篇:從回呼函式發送ziohttp回應
