Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vigoo committed Nov 18, 2023
1 parent fed8f0a commit 788b196
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ lazy val zioSchemaThrift = crossProject(JSPlatform, JVMPlatform)
.settings(buildInfoSettings("zio.schema.thrift"))
.settings(
libraryDependencies ++= Seq(
"org.apache.thrift" % "libthrift" % thriftVersion
"org.apache.thrift" % "libthrift" % thriftVersion,
"javax.annotation" % "javax.annotation-api" % javaxAnnotationApiVersion
)
)

Expand Down
1 change: 1 addition & 0 deletions project/BuildHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ object BuildHelper {
val msgpackVersion = "0.9.6"
val jacksonScalaVersion = "2.14.2"
val thriftVersion = "0.18.1"
val javaxAnnotationApiVersion = "1.3.2"

private val testDeps = Seq(
"dev.zio" %% "zio-test" % zioVersion % Test,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ object DeriveSchema {

val typeArgs = subtypes ++ Iterable(tpe)

val cases = subtypes.map { subtype: Type =>
val cases = subtypes.map { (subtype: Type) =>
@nowarn
val typeAnnotations: List[Tree] =
subtype.typeSymbol.annotations.collect {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ object Derive {
DeriveInstance().deriveInstance[F, A](deriver, schema, top = true)
}

private case class DeriveInstance()(using val ctx: Quotes) extends ReflectionUtils(ctx) {
private case class DeriveInstance()(using val ctx: Quotes) {
val reflectionUtils = ReflectionUtils(ctx)
import reflectionUtils.{MirrorType, Mirror, summonOptional}
import ctx.reflect._

case class Frame(ref: Term, tpe: TypeRepr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ object DeriveSchema {
DeriveSchema().deriveSchema[T](top = true)
}

private case class DeriveSchema()(using val ctx: Quotes) extends ReflectionUtils(ctx) {
private case class DeriveSchema()(using val ctx: Quotes) {
val reflectionUtils = ReflectionUtils(ctx)
import reflectionUtils.{MirrorType, Mirror, summonOptional}
import ctx.reflect._

case class Frame(ref: Term, tpe: TypeRepr)
Expand Down
4 changes: 2 additions & 2 deletions zio-schema/shared/src/main/scala/zio/schema/Schema.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package zio.schema

import java.net.{ URI, URL }
import java.net.URI
import java.time.temporal.ChronoUnit

import scala.annotation.tailrec
Expand Down Expand Up @@ -320,7 +320,7 @@ object Schema extends SchemaEquality {
Schema[String].transformOrFail(
string =>
try {
Right(new URL(string))
Right(new URI(string).toURL)
} catch { case _: Exception => Left(s"Invalid URL: $string") },
url => Right(url.toString)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,9 @@ object ExtensibleMetaSchema {
Schema.Primitive(typ, Chunk.empty)
case ExtensibleMetaSchema.FailNode(msg, _, _) => Schema.Fail(msg)
case ExtensibleMetaSchema.Ref(refPath, _, _) =>
Schema.defer(
refs.getOrElse(refPath, Schema.Fail(s"invalid ref path $refPath"))
)
def resolve[A](): Schema[A] =
refs.getOrElse(refPath, Schema.Fail(s"invalid ref path $refPath")).asInstanceOf[Schema[A]]
Schema.defer(resolve())
case ExtensibleMetaSchema.Product(id, _, elems, _) =>
Schema.record(
id,
Expand Down

0 comments on commit 788b196

Please sign in to comment.