Skip to content

Commit

Permalink
Remove deprecated methods from zio-json update (#2286)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyri-petrou authored Jun 18, 2024
1 parent 8fab0ae commit e728210
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 84 deletions.
16 changes: 4 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
9 changes: 1 addition & 8 deletions core/src/main/scala/caliban/CalibanError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]]
}
9 changes: 1 addition & 8 deletions core/src/main/scala/caliban/GraphQLRequest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
}
9 changes: 1 addition & 8 deletions core/src/main/scala/caliban/GraphQLResponse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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]]]
}
9 changes: 1 addition & 8 deletions core/src/main/scala/caliban/GraphQLWSInput.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand All @@ -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]]
}
9 changes: 1 addition & 8 deletions core/src/main/scala/caliban/GraphQLWSOutput.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand All @@ -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]]
}
16 changes: 1 addition & 15 deletions core/src/main/scala/caliban/Value.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 =>
Expand Down Expand Up @@ -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
Expand Down
18 changes: 1 addition & 17 deletions core/src/main/scala/caliban/interop/zio/zio.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e728210

Please sign in to comment.