From e728210522bd03f78a2f03a38a6f3485fa4ac861 Mon Sep 17 00:00:00 2001 From: kyri-petrou <67301607+kyri-petrou@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:28:16 +1000 Subject: [PATCH] Remove deprecated methods from zio-json update (#2286) --- build.sbt | 16 ++++------------ core/src/main/scala/caliban/CalibanError.scala | 9 +-------- .../main/scala/caliban/GraphQLRequest.scala | 9 +-------- .../main/scala/caliban/GraphQLResponse.scala | 9 +-------- .../main/scala/caliban/GraphQLWSInput.scala | 9 +-------- .../main/scala/caliban/GraphQLWSOutput.scala | 9 +-------- core/src/main/scala/caliban/Value.scala | 16 +--------------- .../main/scala/caliban/interop/zio/zio.scala | 18 +----------------- 8 files changed, 11 insertions(+), 84 deletions(-) diff --git a/build.sbt b/build.sbt index dc805354f..7d1de027d 100644 --- a/build.sbt +++ b/build.sbt @@ -738,21 +738,13 @@ lazy val commonSettings = Def.settings( }) ) -lazy val enforceMimaCompatibility = true // Enable / disable failing CI on binary incompatibilities +lazy val enforceMimaCompatibility = false // Enable / disable failing CI on binary incompatibilities lazy val enableMimaSettingsJVM = Def.settings( - mimaFailOnProblem := enforceMimaCompatibility, - mimaPreviousArtifacts := previousStableVersion.value.map(organization.value %% moduleName.value % _).toSet, - mimaBinaryIssueFilters ++= Seq( - ProblemFilters.exclude[IncompatibleMethTypeProblem]("caliban.execution.Executor#ReducedStepExecutor.makeQuery"), - ProblemFilters.exclude[DirectMissingMethodProblem]("caliban.parsing.adt.Type.$init$"), - ProblemFilters.exclude[DirectMissingMethodProblem]("caliban.introspection.adt.__Type.*"), - ProblemFilters.exclude[DirectMissingMethodProblem]("caliban.introspection.adt.__InputValue.*"), - ProblemFilters.exclude[FinalMethodProblem]("caliban.parsing.adt.Type*"), - ProblemFilters.exclude[MissingTypesProblem]("caliban.introspection.adt.__Type$"), - ProblemFilters.exclude[MissingTypesProblem]("caliban.introspection.adt.__InputValue$") - ) + mimaFailOnProblem := enforceMimaCompatibility, + mimaPreviousArtifacts := previousStableVersion.value.map(organization.value %% moduleName.value % _).toSet, + mimaBinaryIssueFilters := Seq() ) lazy val enableMimaSettingsJS = diff --git a/core/src/main/scala/caliban/CalibanError.scala b/core/src/main/scala/caliban/CalibanError.scala index 1f89ca9e6..3dc8f952f 100644 --- a/core/src/main/scala/caliban/CalibanError.scala +++ b/core/src/main/scala/caliban/CalibanError.scala @@ -5,7 +5,7 @@ import caliban.Value.StringValue import caliban.interop.circe.{ IsCirceDecoder, IsCirceEncoder } import caliban.interop.jsoniter.IsJsoniterCodec import caliban.interop.play.{ IsPlayJsonReads, IsPlayJsonWrites } -import caliban.interop.zio.{ IsZIOJsonCodec, IsZIOJsonDecoder, IsZIOJsonEncoder } +import caliban.interop.zio.IsZIOJsonCodec import caliban.parsing.adt.LocationInfo import scala.util.control.NoStackTrace @@ -98,11 +98,4 @@ object CalibanError { caliban.interop.play.json.ErrorPlayJson.errorValueWrites.asInstanceOf[F[CalibanError]] implicit def playJsonReads[F[_]](implicit ev: IsPlayJsonReads[F]): F[CalibanError] = caliban.interop.play.json.ErrorPlayJson.errorValueReads.asInstanceOf[F[CalibanError]] - - @deprecated("kept for compatibility purposes only", "1.7.2") - def zioJsonEncoder[F[_]](implicit ev: IsZIOJsonEncoder[F]): F[CalibanError] = - caliban.interop.zio.ErrorZioJson.errorValueEncoder.asInstanceOf[F[CalibanError]] - @deprecated("kept for compatibility purposes only", "1.7.2") - def zioJsonDecoder[F[_]](implicit ev: IsZIOJsonDecoder[F]): F[CalibanError] = - caliban.interop.zio.ErrorZioJson.errorValueDecoder.asInstanceOf[F[CalibanError]] } diff --git a/core/src/main/scala/caliban/GraphQLRequest.scala b/core/src/main/scala/caliban/GraphQLRequest.scala index b9d44f6c4..14dade1b3 100644 --- a/core/src/main/scala/caliban/GraphQLRequest.scala +++ b/core/src/main/scala/caliban/GraphQLRequest.scala @@ -6,7 +6,7 @@ import caliban.interop.circe.{ IsCirceDecoder, IsCirceEncoder } import caliban.interop.jsoniter.IsJsoniterCodec import caliban.interop.play.{ IsPlayJsonReads, IsPlayJsonWrites } import caliban.interop.tapir.IsTapirSchema -import caliban.interop.zio.{ IsZIOJsonCodec, IsZIOJsonDecoder, IsZIOJsonEncoder } +import caliban.interop.zio.IsZIOJsonCodec /** * Represents a GraphQL request, containing a query, an operation name and a map of variables. @@ -45,13 +45,6 @@ object GraphQLRequest { implicit def playJsonWrites[F[_]: IsPlayJsonWrites]: F[GraphQLRequest] = caliban.interop.play.json.GraphQLRequestPlayJson.graphQLRequestWrites.asInstanceOf[F[GraphQLRequest]] - @deprecated("kept for compatibility purposes only", "1.7.2") - def zioJsonDecoder[F[_]: IsZIOJsonDecoder]: F[GraphQLRequest] = - caliban.interop.zio.GraphQLRequestZioJson.graphQLRequestDecoder.asInstanceOf[F[GraphQLRequest]] - @deprecated("kept for compatibility purposes only", "1.7.2") - def zioJsonEncoder[F[_]: IsZIOJsonEncoder]: F[GraphQLRequest] = - caliban.interop.zio.GraphQLRequestZioJson.graphQLRequestEncoder.asInstanceOf[F[GraphQLRequest]] - private[caliban] final val ftv1 = "ftv1" private[caliban] final val `apollo-federation-include-trace` = "apollo-federation-include-trace" } diff --git a/core/src/main/scala/caliban/GraphQLResponse.scala b/core/src/main/scala/caliban/GraphQLResponse.scala index 99809c139..88622a3b2 100644 --- a/core/src/main/scala/caliban/GraphQLResponse.scala +++ b/core/src/main/scala/caliban/GraphQLResponse.scala @@ -6,7 +6,7 @@ import caliban.interop.circe._ import caliban.interop.jsoniter.IsJsoniterCodec import caliban.interop.play.{ IsPlayJsonReads, IsPlayJsonWrites } import caliban.interop.tapir.IsTapirSchema -import caliban.interop.zio.{ IsZIOJsonCodec, IsZIOJsonDecoder, IsZIOJsonEncoder } +import caliban.interop.zio.IsZIOJsonCodec import scala.collection.mutable.ListBuffer @@ -69,11 +69,4 @@ object GraphQLResponse { caliban.interop.play.json.GraphQLResponsePlayJson.graphQLResponseWrites.asInstanceOf[F[GraphQLResponse[E]]] implicit def playJsonReads[F[_]: IsPlayJsonReads, E]: F[GraphQLResponse[E]] = caliban.interop.play.json.GraphQLResponsePlayJson.graphQLResponseReads.asInstanceOf[F[GraphQLResponse[E]]] - - @deprecated("kept for compatibility purposes only", "1.7.2") - def zioJsonEncoder[F[_]: IsZIOJsonEncoder, E]: F[GraphQLResponse[E]] = - caliban.interop.zio.GraphQLResponseZioJson.graphQLResponseEncoder.asInstanceOf[F[GraphQLResponse[E]]] - @deprecated("kept for compatibility purposes only", "1.7.2") - def zioJsonDecoder[F[_]: IsZIOJsonDecoder, E]: F[GraphQLResponse[E]] = - caliban.interop.zio.GraphQLResponseZioJson.graphQLResponseDecoder.asInstanceOf[F[GraphQLResponse[E]]] } diff --git a/core/src/main/scala/caliban/GraphQLWSInput.scala b/core/src/main/scala/caliban/GraphQLWSInput.scala index ded55a1a9..1c4f78ff6 100644 --- a/core/src/main/scala/caliban/GraphQLWSInput.scala +++ b/core/src/main/scala/caliban/GraphQLWSInput.scala @@ -4,7 +4,7 @@ import caliban.interop.circe.{ IsCirceDecoder, IsCirceEncoder } import caliban.interop.jsoniter.IsJsoniterCodec import caliban.interop.play.{ IsPlayJsonReads, IsPlayJsonWrites } import caliban.interop.tapir.IsTapirSchema -import caliban.interop.zio.{ IsZIOJsonCodec, IsZIOJsonDecoder, IsZIOJsonEncoder } +import caliban.interop.zio.IsZIOJsonCodec case class GraphQLWSInput(`type`: String, id: Option[String], payload: Option[InputValue]) @@ -23,11 +23,4 @@ object GraphQLWSInput { caliban.interop.play.json.GraphQLWSInputPlayJson.graphQLWSInputReads.asInstanceOf[F[GraphQLWSInput]] implicit def playJsonWrites[F[_]: IsPlayJsonWrites]: F[GraphQLWSInput] = caliban.interop.play.json.GraphQLWSInputPlayJson.graphQLWSInputWrites.asInstanceOf[F[GraphQLWSInput]] - - @deprecated("kept for compatibility purposes only", "1.7.2") - def zioJsonDecoder[F[_]: IsZIOJsonDecoder]: F[GraphQLWSInput] = - caliban.interop.zio.GraphQLWSInputZioJson.graphQLWSInputDecoder.asInstanceOf[F[GraphQLWSInput]] - @deprecated("kept for compatibility purposes only", "1.7.2") - def zioJsonEncoder[F[_]: IsZIOJsonEncoder]: F[GraphQLWSInput] = - caliban.interop.zio.GraphQLWSInputZioJson.graphQLWSInputEncoder.asInstanceOf[F[GraphQLWSInput]] } diff --git a/core/src/main/scala/caliban/GraphQLWSOutput.scala b/core/src/main/scala/caliban/GraphQLWSOutput.scala index 55a5dc09b..87919e683 100644 --- a/core/src/main/scala/caliban/GraphQLWSOutput.scala +++ b/core/src/main/scala/caliban/GraphQLWSOutput.scala @@ -4,7 +4,7 @@ import caliban.interop.circe.{ IsCirceDecoder, IsCirceEncoder } import caliban.interop.jsoniter.IsJsoniterCodec import caliban.interop.play.{ IsPlayJsonReads, IsPlayJsonWrites } import caliban.interop.tapir.IsTapirSchema -import caliban.interop.zio.{ IsZIOJsonCodec, IsZIOJsonDecoder, IsZIOJsonEncoder } +import caliban.interop.zio.IsZIOJsonCodec case class GraphQLWSOutput(`type`: String, id: Option[String], payload: Option[ResponseValue]) @@ -23,11 +23,4 @@ object GraphQLWSOutput { caliban.interop.play.json.GraphQLWSOutputPlayJson.graphQLWSOutputReads.asInstanceOf[F[GraphQLWSOutput]] implicit def playJsonWrites[F[_]: IsPlayJsonWrites]: F[GraphQLWSOutput] = caliban.interop.play.json.GraphQLWSOutputPlayJson.graphQLWSOutputWrites.asInstanceOf[F[GraphQLWSOutput]] - - @deprecated("kept for compatibility purposes only", "1.7.2") - def zioJsonDecoder[F[_]: IsZIOJsonDecoder]: F[GraphQLWSOutput] = - caliban.interop.zio.GraphQLWSOutputZioJson.graphQLWSOutputDecoder.asInstanceOf[F[GraphQLWSOutput]] - @deprecated("kept for compatibility purposes only", "1.7.2") - def zioJsonEncoder[F[_]: IsZIOJsonEncoder]: F[GraphQLWSOutput] = - caliban.interop.zio.GraphQLWSOutputZioJson.graphQLWSOutputEncoder.asInstanceOf[F[GraphQLWSOutput]] } diff --git a/core/src/main/scala/caliban/Value.scala b/core/src/main/scala/caliban/Value.scala index 63120712c..ee67ebed7 100644 --- a/core/src/main/scala/caliban/Value.scala +++ b/core/src/main/scala/caliban/Value.scala @@ -5,7 +5,7 @@ import caliban.interop.circe._ import caliban.interop.jsoniter.IsJsoniterCodec import caliban.interop.play.{ IsPlayJsonReads, IsPlayJsonWrites } import caliban.interop.tapir.IsTapirSchema -import caliban.interop.zio.{ IsZIOJsonCodec, IsZIOJsonDecoder, IsZIOJsonEncoder } +import caliban.interop.zio.IsZIOJsonCodec import caliban.rendering.ValueRenderer import zio.stream.Stream @@ -42,13 +42,6 @@ object InputValue { caliban.interop.play.json.ValuePlayJson.inputValueWrites.asInstanceOf[F[InputValue]] implicit def inputValuePlayJsonReads[F[_]: IsPlayJsonReads]: F[InputValue] = caliban.interop.play.json.ValuePlayJson.inputValueReads.asInstanceOf[F[InputValue]] - - @deprecated("kept for compatibility purposes only", "1.7.2") - def inputValueZioJsonEncoder[F[_]: IsZIOJsonEncoder]: F[InputValue] = - caliban.interop.zio.ValueZIOJson.inputValueEncoder.asInstanceOf[F[InputValue]] - @deprecated("kept for compatibility purposes only", "1.7.2") - def inputValueZioJsonDecoder[F[_]: IsZIOJsonDecoder]: F[InputValue] = - caliban.interop.zio.ValueZIOJson.inputValueDecoder.asInstanceOf[F[InputValue]] } sealed trait ResponseValue extends Serializable { self => @@ -136,13 +129,6 @@ object ResponseValue { caliban.interop.play.json.ValuePlayJson.responseValueWrites.asInstanceOf[F[ResponseValue]] implicit def responseValuePlayJsonReads[F[_]: IsPlayJsonReads]: F[ResponseValue] = caliban.interop.play.json.ValuePlayJson.responseValueReads.asInstanceOf[F[ResponseValue]] - - @deprecated("kept for compatibility purposes only", "1.7.2") - def responseValueZioJsonEncoder[F[_]: IsZIOJsonEncoder]: F[ResponseValue] = - caliban.interop.zio.ValueZIOJson.responseValueEncoder.asInstanceOf[F[ResponseValue]] - @deprecated("kept for compatibility purposes only", "1.7.2") - def responseValueZioJsonDecoder[F[_]: IsZIOJsonDecoder]: F[ResponseValue] = - caliban.interop.zio.ValueZIOJson.responseValueDecoder.asInstanceOf[F[ResponseValue]] } sealed trait Value extends InputValue with ResponseValue diff --git a/core/src/main/scala/caliban/interop/zio/zio.scala b/core/src/main/scala/caliban/interop/zio/zio.scala index 2b8e5e55b..48d855029 100644 --- a/core/src/main/scala/caliban/interop/zio/zio.scala +++ b/core/src/main/scala/caliban/interop/zio/zio.scala @@ -8,26 +8,10 @@ import caliban.schema.Types.makeScalar import caliban.schema.{ ArgBuilder, PureStep, Schema, Step } import zio.Chunk import zio.json.ast.Json -import zio.json.{ JsonCodec, JsonDecoder, JsonEncoder } +import zio.json.JsonCodec import scala.annotation.switch -@deprecated("kept for compatibility purposes only", "1.7.2") -private[caliban] trait IsZIOJsonEncoder[F[_]] - -@deprecated("kept for compatibility purposes only", "1.7.2") -private[caliban] object IsZIOJsonEncoder { - implicit val isZIOJsonEncoder: IsZIOJsonEncoder[JsonEncoder] = null -} - -@deprecated("kept for compatibility purposes only", "1.7.2") -private[caliban] trait IsZIOJsonDecoder[F[_]] - -@deprecated("kept for compatibility purposes only", "1.7.2") -private[caliban] object IsZIOJsonDecoder { - implicit val isZIOJsonDecoder: IsZIOJsonDecoder[JsonDecoder] = null -} - /** * This class is an implementation of the pattern described in https://blog.7mind.io/no-more-orphans.html * It makes it possible to mark circe dependency as optional and keep Encoders defined in the companion object.