diff --git a/modules/json/src/main/scala/io/renku/json/EncoderSupport.scala b/modules/json/src/main/scala/io/renku/json/EncoderSupport.scala index 3cd1fa8e..641a9261 100644 --- a/modules/json/src/main/scala/io/renku/json/EncoderSupport.scala +++ b/modules/json/src/main/scala/io/renku/json/EncoderSupport.scala @@ -97,16 +97,21 @@ object EncoderSupport { final inline def membersEncoder[T](using m: Mirror.ProductOf[T] ): Encoder[T] = - new Encoder[T] { - def write(w: Writer, value: T): Writer = - val encoders = summonEncoder[m.MirroredElemTypes] - val names = LabelsMacro.findLabels[T].toList - val values = value.asInstanceOf[Product].productIterator.toList - names.zip(values).zip(encoders).foreach { case ((k, v), e) => - w.writeMapMember(k, v)(using Encoder[String], e.asInstanceOf[Encoder[Any]]) - } - w - } + val encoders = summonEncoder[m.MirroredElemTypes] + val names = LabelsMacro.findLabels[T].toList + new MemberEncoderImpl[T](names, encoders) + + final private class MemberEncoderImpl[T]( + names: List[String], + encoders: List[Encoder[?]] + ) extends Encoder[T] { + def write(w: Writer, value: T): Writer = + val values = value.asInstanceOf[Product].productIterator.toList + names.zip(values).zip(encoders).foreach { case ((k, v), e) => + w.writeMapMember(k, v)(using Encoder[String], e.asInstanceOf[Encoder[Any]]) + } + w + } final inline def createEncoder[K: Encoder, V: Encoder, T]( additionalFields: AdditionalFields[T, V] diff --git a/modules/json/src/main/scala/io/renku/json/LabelsMacro.scala b/modules/json/src/main/scala/io/renku/json/LabelsMacro.scala index 42c41f4a..4abac4b5 100644 --- a/modules/json/src/main/scala/io/renku/json/LabelsMacro.scala +++ b/modules/json/src/main/scala/io/renku/json/LabelsMacro.scala @@ -28,7 +28,7 @@ private object LabelsMacro: private def findLabelsImpl[T: Type](using q: Quotes): Expr[Seq[String]] = { import q.reflect.* - val keyAnno = TypeRepr.of[io.bullet.borer.derivation.key] + val keyAnno = TypeRepr.of[key] def keyAnnotation(s: Symbol): Expr[Option[String]] = { val key = s.annotations.find(_.tpe <:< keyAnno).map { diff --git a/modules/redis-client/src/test/scala/io/renku/redis/client/RedisQueueClientSpec.scala b/modules/redis-client/src/test/scala/io/renku/redis/client/RedisQueueClientSpec.scala index 3c8e89e6..1ad99b9f 100644 --- a/modules/redis-client/src/test/scala/io/renku/redis/client/RedisQueueClientSpec.scala +++ b/modules/redis-client/src/test/scala/io/renku/redis/client/RedisQueueClientSpec.scala @@ -27,7 +27,6 @@ import fs2.concurrent.SignallingRef import dev.profunktor.redis4cats.connection.RedisClient import dev.profunktor.redis4cats.streams.data.XAddMessage import dev.profunktor.redis4cats.streams.{RedisStream, Streaming} -import io.renku.redis.client.RedisClientGenerators.* import io.renku.redis.client.util.RedisBaseSuite import io.renku.search.GeneratorSyntax.* import munit.CatsEffectSuite diff --git a/modules/redis-client/src/test/scala/io/renku/redis/client/util/RedisBaseSuite.scala b/modules/redis-client/src/test/scala/io/renku/redis/client/util/RedisBaseSuite.scala index cb48de10..3c6fcada 100644 --- a/modules/redis-client/src/test/scala/io/renku/redis/client/util/RedisBaseSuite.scala +++ b/modules/redis-client/src/test/scala/io/renku/redis/client/util/RedisBaseSuite.scala @@ -21,7 +21,6 @@ package io.renku.redis.client.util import cats.effect.* import dev.profunktor.redis4cats.Redis -import dev.profunktor.redis4cats.RedisCommands import dev.profunktor.redis4cats.connection.RedisClient import dev.profunktor.redis4cats.data.RedisCodec import dev.profunktor.redis4cats.effect.Log as RedisLog diff --git a/modules/search-provision/src/main/scala/io/renku/search/provision/events/Users.scala b/modules/search-provision/src/main/scala/io/renku/search/provision/events/Users.scala index a0f79897..9a5d9cf5 100644 --- a/modules/search-provision/src/main/scala/io/renku/search/provision/events/Users.scala +++ b/modules/search-provision/src/main/scala/io/renku/search/provision/events/Users.scala @@ -20,7 +20,6 @@ package io.renku.search.provision.events import cats.syntax.all.* -import io.renku.events.v1.UserUpdated import io.renku.events.{v1, v2} import io.renku.search.events.syntax.* import io.renku.search.solr.documents.User as UserDocument diff --git a/modules/search-provision/src/main/scala/io/renku/search/provision/handler/FetchFromSolr.scala b/modules/search-provision/src/main/scala/io/renku/search/provision/handler/FetchFromSolr.scala index b1bc4ae0..cb314804 100644 --- a/modules/search-provision/src/main/scala/io/renku/search/provision/handler/FetchFromSolr.scala +++ b/modules/search-provision/src/main/scala/io/renku/search/provision/handler/FetchFromSolr.scala @@ -28,7 +28,6 @@ import io.renku.search.events.EventMessage import io.renku.search.model.{EntityType, Id, Namespace} import io.renku.search.provision.handler.FetchFromSolr.* import io.renku.search.solr.client.SearchSolrClient -import io.renku.search.solr.documents.DocumentKind import io.renku.search.solr.documents.{ Group as GroupDocument, Project as ProjectDocument, diff --git a/modules/search-provision/src/main/scala/io/renku/search/provision/metrics/SolrMetrics.scala b/modules/search-provision/src/main/scala/io/renku/search/provision/metrics/SolrMetrics.scala index 56e8d4f6..fe80eec3 100644 --- a/modules/search-provision/src/main/scala/io/renku/search/provision/metrics/SolrMetrics.scala +++ b/modules/search-provision/src/main/scala/io/renku/search/provision/metrics/SolrMetrics.scala @@ -19,7 +19,6 @@ package io.renku.search.provision.metrics import io.renku.search.model.EntityType -import io.renku.search.model.EntityType.* object SolrMetrics: diff --git a/modules/search-provision/src/test/scala/io/renku/search/provision/group/GroupRemovedProcessSpec.scala b/modules/search-provision/src/test/scala/io/renku/search/provision/group/GroupRemovedProcessSpec.scala index 026e48d0..80a1f6fc 100644 --- a/modules/search-provision/src/test/scala/io/renku/search/provision/group/GroupRemovedProcessSpec.scala +++ b/modules/search-provision/src/test/scala/io/renku/search/provision/group/GroupRemovedProcessSpec.scala @@ -29,7 +29,6 @@ import io.renku.search.provision.ProvisioningSuite import io.renku.search.solr.client.SearchSolrClient import io.renku.search.solr.client.SolrDocumentGenerators import io.renku.search.solr.client.SolrDocumentGenerators.* -import io.renku.search.solr.documents.DocumentKind import io.renku.search.solr.documents.{ Group as GroupDocument, Project as ProjectDocument, diff --git a/modules/search-provision/src/test/scala/io/renku/search/provision/project/AuthorizationRemovedProvisioningSpec.scala b/modules/search-provision/src/test/scala/io/renku/search/provision/project/AuthorizationRemovedProvisioningSpec.scala index 0c6bdda4..1457c2d7 100644 --- a/modules/search-provision/src/test/scala/io/renku/search/provision/project/AuthorizationRemovedProvisioningSpec.scala +++ b/modules/search-provision/src/test/scala/io/renku/search/provision/project/AuthorizationRemovedProvisioningSpec.scala @@ -29,7 +29,6 @@ import io.renku.search.model.ModelGenerators import io.renku.search.provision.project.AuthorizationRemovedProvisioningSpec.testCases import io.renku.search.solr.client.SearchSolrClient import io.renku.search.solr.client.SolrDocumentGenerators -import io.renku.search.solr.documents.PartialEntityDocument import io.renku.search.solr.documents.{Project as ProjectDocument, *} import io.renku.solr.client.DocVersion import org.scalacheck.Gen diff --git a/modules/search-provision/src/test/scala/io/renku/search/provision/project/ProjectUpdatedProvisioningSpec.scala b/modules/search-provision/src/test/scala/io/renku/search/provision/project/ProjectUpdatedProvisioningSpec.scala index f17937bb..545385fc 100644 --- a/modules/search-provision/src/test/scala/io/renku/search/provision/project/ProjectUpdatedProvisioningSpec.scala +++ b/modules/search-provision/src/test/scala/io/renku/search/provision/project/ProjectUpdatedProvisioningSpec.scala @@ -22,7 +22,6 @@ import cats.effect.IO import cats.syntax.all.* import io.renku.events.EventsGenerators -import io.renku.events.EventsGenerators.* import io.renku.search.GeneratorSyntax.* import io.renku.search.events.* import io.renku.search.model.Id diff --git a/modules/search-provision/src/test/scala/io/renku/search/provision/user/UserRemovedProcessSpec.scala b/modules/search-provision/src/test/scala/io/renku/search/provision/user/UserRemovedProcessSpec.scala index adc4853c..41d7e43a 100644 --- a/modules/search-provision/src/test/scala/io/renku/search/provision/user/UserRemovedProcessSpec.scala +++ b/modules/search-provision/src/test/scala/io/renku/search/provision/user/UserRemovedProcessSpec.scala @@ -22,7 +22,6 @@ import cats.data.NonEmptyList import cats.effect.IO import io.renku.events.EventsGenerators -import io.renku.events.EventsGenerators.* import io.renku.search.GeneratorSyntax.* import io.renku.search.events.* import io.renku.search.model.{EntityType, Id, ModelGenerators} diff --git a/modules/solr-client/src/main/scala/io/renku/solr/client/SolrClient.scala b/modules/solr-client/src/main/scala/io/renku/solr/client/SolrClient.scala index ceb9ddd3..1625e9a4 100644 --- a/modules/solr-client/src/main/scala/io/renku/solr/client/SolrClient.scala +++ b/modules/solr-client/src/main/scala/io/renku/solr/client/SolrClient.scala @@ -26,7 +26,6 @@ import io.bullet.borer.{Decoder, Encoder} import io.renku.search.http.{ClientBuilder, ResponseLogging, RetryConfig} import io.renku.solr.client.schema.SchemaCommand import org.http4s.ember.client.EmberClientBuilder -import org.http4s.ember.client.EmberClientBuilder.default trait SolrClient[F[_]]: def config: SolrConfig diff --git a/project/Dependencies.scala b/project/Dependencies.scala index d06d2129..425358c5 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -19,7 +19,7 @@ object Dependencies { val http4sPrometheusMetrics = "0.24.6" val redis4Cats = "1.7.1" val sbtMdoc = "2.5.2" - val scala = "3.4.3" + val scala = "3.5.0" val scalacheckEffectMunit = "2.0.0-M2" val scodec = "2.2.2" val scodecBits = "1.2.1"