I have a strange IDE error, but the code compiles and runs. How can I fix the problem? A code example and a screenshot of the issue are attached.

I have a strange IDE error, but the code compiles and runs. How can I fix the problem? A code example and a screenshot of the issue are attached.

--------------------

Type mismatch.
Required:
ZServerEndpoint [Any,Any]
Found:
ZServerEndpoint[Any,Any]

--------------------

import zio._
import sttp.tapir.ztapir._
import sttp.tapir.server.ziohttp.ZioHttpInterpreter
import zio.http.{Response, Routes, Server}
object Main extends ZIOAppDefault {
 case class Pet(species: String, url: String)
   def authLogic(token: String): ZIO[Any, String, String] = {
     if (token != "secret")
       ZIO.fail("user not login")
     else ZIO.succeed(token)
   }
   val authEndpoint: ZPartialServerEndpoint[Any, String, String, Unit, String, Unit, Any] =
     endpoint
       .securityIn(auth.bearer[String]())
       .errorOut(stringBody)
       .zServerSecurityLogic(authLogic)
 val secureHelloWorldEndpoint: ZServerEndpoint[Any, Any] = authEndpoint
   .get
   .in("hello")
   .in(query[String]("salutation"))
   .out(stringBody)
   .serverLogic { token => salutation =>
     ZIO.succeed(s"$salutation, authenticated with token: $token!")
   }
 val routes: Routes[Any, Response] = ZioHttpInterpreter().toHttp(secureHelloWorldEndpoint)
 override def run: URIO[Any, ExitCode] =
   Server
     .serve(routes)
     .provide(
       ZLayer.succeed(Server.Config.default.port(8080)),
       Server.live
     )
     .exitCode
}
0

Please sign in to leave a comment.