From 0f0607475d3f72080f8d9f79869cd2be5da05af6 Mon Sep 17 00:00:00 2001 From: Oliver <20188437+olivergrabinski@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:14:34 +0200 Subject: [PATCH] Add TODOs --- .../nexus/delta/sdk/resources/model/ResourceEvent.scala | 5 +++++ .../nexus/delta/sdk/resources/model/ResourceState.scala | 4 ++++ .../sdk/resources/model/ResourceSerializationSuite.scala | 2 ++ 3 files changed, 11 insertions(+) diff --git a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceEvent.scala b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceEvent.scala index 4632a8ab7d..97d596de23 100644 --- a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceEvent.scala +++ b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceEvent.scala @@ -90,6 +90,7 @@ object ResourceEvent { source: Json, compacted: CompactedJsonLd, expanded: ExpandedJsonLd, + // TODO: Remove default after 1.10 migration remoteContexts: Set[RemoteContextRef] = Set.empty, rev: Int, instant: Instant, @@ -133,6 +134,7 @@ object ResourceEvent { source: Json, compacted: CompactedJsonLd, expanded: ExpandedJsonLd, + // TODO: Remove default after 1.10 migration remoteContexts: Set[RemoteContextRef] = Set.empty, rev: Int, instant: Instant, @@ -173,6 +175,7 @@ object ResourceEvent { types: Set[Iri], compacted: CompactedJsonLd, expanded: ExpandedJsonLd, + // TODO: Remove default after 1.10 migration remoteContexts: Set[RemoteContextRef] = Set.empty, rev: Int, instant: Instant, @@ -269,6 +272,8 @@ object ResourceEvent { import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.ExpandedJsonLd.Database._ import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.Database._ + // TODO: The `.withDefaults` method is used in order to inject the default empty remoteContexts + // when deserializing an event that has none. Remove it after 1.10 migration. implicit val configuration: Configuration = Serializer.circeConfiguration.withDefaults implicit val coder: Codec.AsObject[ResourceEvent] = deriveConfiguredCodec[ResourceEvent] diff --git a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceState.scala b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceState.scala index d5b491f152..5e40514e42 100644 --- a/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceState.scala +++ b/delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceState.scala @@ -59,6 +59,7 @@ final case class ResourceState( source: Json, compacted: CompactedJsonLd, expanded: ExpandedJsonLd, + // TODO: Remove default after 1.10 migration remoteContexts: Set[RemoteContextRef] = Set.empty, rev: Int, deprecated: Boolean, @@ -94,6 +95,9 @@ object ResourceState { import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.CompactedJsonLd.Database._ import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.ExpandedJsonLd.Database._ import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.Database._ + + // TODO: The `.withDefaults` method is used in order to inject the default empty remoteContexts + // when deserializing an event that has none. Remove it after 1.10 migration. implicit val configuration: Configuration = Serializer.circeConfiguration.withDefaults implicit val codec: Codec.AsObject[ResourceState] = deriveConfiguredCodec[ResourceState] Serializer() diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceSerializationSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceSerializationSuite.scala index 6ef0c87627..395328cab2 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceSerializationSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceSerializationSuite.scala @@ -145,6 +145,7 @@ class ResourceSerializationSuite extends SerializationSuite with ResourceInstanc (refreshed.noRemoteContext, jsonContentOf("resources/database/resource-refreshed-no-remote-contexts.json")) ) + // TODO: Remove test after 1.10 migration. resourcesMappingNoRemoteContexts.foreach { case (event, database) => test(s"Correctly deserialize a ${event.getClass.getSimpleName} with no RemoteContext") { assertEquals(ResourceEvent.serializer.codec.decodeJson(database), Right(event)) @@ -181,6 +182,7 @@ class ResourceSerializationSuite extends SerializationSuite with ResourceInstanc assertEquals(ResourceState.serializer.codec.decodeJson(jsonState), Right(state)) } + // TODO: Remove test after 1.10 migration. test("Correctly deserialize a ResourceState with no remote contexts") { assertEquals( ResourceState.serializer.codec.decodeJson(jsonStateNoRemoteContext),