diff --git a/build.sbt b/build.sbt index 478857687..b46238075 100644 --- a/build.sbt +++ b/build.sbt @@ -4,6 +4,8 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ Global / onChangedBuildSource := ReloadOnSourceChanges +addCompilerPlugin("com.lihaoyi" %% "unroll-plugin" % "0.1.12") + inThisBuild( List( name := "zio-schema", @@ -149,10 +151,11 @@ lazy val zioSchema = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings(buildInfoSettings("zio.schema")) .settings( libraryDependencies ++= Seq( - "dev.zio" %%% "zio" % zioVersion, - "dev.zio" %%% "zio-streams" % zioVersion, - "dev.zio" %%% "zio-prelude" % zioPreludeVersion, - "dev.zio" %%% "zio-constraintless" % zioConstraintlessVersion + "dev.zio" %%% "zio" % zioVersion, + "dev.zio" %%% "zio-streams" % zioVersion, + "dev.zio" %%% "zio-prelude" % zioPreludeVersion, + "dev.zio" %%% "zio-constraintless" % zioConstraintlessVersion, + "com.lihaoyi" %% "unroll-annotation" % "0.1.12" ) ) .nativeSettings(Test / fork := false) diff --git a/zio-schema-json/shared/src/main/scala/zio/schema/codec/JsonCodec.scala b/zio-schema-json/shared/src/main/scala/zio/schema/codec/JsonCodec.scala index 19aa3fc78..bc7d55aad 100644 --- a/zio-schema-json/shared/src/main/scala/zio/schema/codec/JsonCodec.scala +++ b/zio-schema-json/shared/src/main/scala/zio/schema/codec/JsonCodec.scala @@ -3,7 +3,7 @@ package zio.schema.codec import java.nio.CharBuffer import java.nio.charset.StandardCharsets -import scala.annotation.{ switch, tailrec } +import scala.annotation.{ switch, tailrec, unroll } import scala.collection.immutable.ListMap import zio.json.JsonCodec._ @@ -28,7 +28,7 @@ object JsonCodec { final case class Config( ignoreEmptyCollections: Boolean, - treatStreamsAsArrays: Boolean = false, + @unroll treatStreamsAsArrays: Boolean = false, explicitNulls: Boolean = false )