Skip to content

Commit

Permalink
Add TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
olivergrabinski committed Oct 3, 2023
1 parent 90069ed commit 0f06074
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 0f06074

Please sign in to comment.