Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ data class OneToManyMatchEvent(

override fun setTokenizedFields(map: Map<TokenKeyType, TokenizableString>) = this

// FIX 2: Apply Custom Serializer
@Serializable(with = OneToManyMatchPayloadSerializer::class)
sealed class OneToManyMatchPayload : EventPayload() {
abstract override val type: EventType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,12 @@ data class OneToOneMatchEvent(

override fun getTokenizableFields(): Map<TokenKeyType, TokenizableString> = emptyMap()

override fun setTokenizedFields(map: Map<TokenKeyType, TokenizableString>) = this // No tokenized fields
override fun setTokenizedFields(map: Map<TokenKeyType, TokenizableString>) = this

@Keep
@Serializable(with = OneToOneMatchPayloadSerializer::class) // Now this works!
@Serializable(with = OneToOneMatchPayloadSerializer::class)
sealed class OneToOneMatchPayload : EventPayload() {
abstract override val type: EventType // This caused the conflict, now it's just a property

abstract override val type: EventType
abstract val candidateId: String
abstract val matcher: String
abstract val result: MatchEntry?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import org.junit.Test
import kotlin.test.assertEquals

class CoSyncEnrolmentRecordCreationEventDeserializerTest {
// Configure Json to be lenient if necessary, though strict is better for validation.
// 'ignoreUnknownKeys' helps if the JSON contains fields not in the model.
private val json = JsonHelper.json

@Test
Expand Down Expand Up @@ -79,8 +77,10 @@ class CoSyncEnrolmentRecordCreationEventDeserializerTest {
// Assuming the fallback logic wraps the JSON string:
assert(result.payload.moduleId is TokenizableString.Raw)
assert(result.payload.attendantId is TokenizableString.Raw)
assertEquals(TokenizableString.Raw(ENCRYPTED_MODULE), result.payload.moduleId)
assertEquals(TokenizableString.Raw(UNENCRYPTED_ATTENDANT), result.payload.attendantId)

assertEquals(emptyList<BiometricReference>(), result.payload.biometricReferences)
assertEquals(emptyList(), result.payload.biometricReferences)
}

companion object {
Expand All @@ -92,7 +92,6 @@ class CoSyncEnrolmentRecordCreationEventDeserializerTest {
const val ENCRYPTED_MODULE = "encrypted-module-1"
const val UNENCRYPTED_ATTENDANT = "unencrypted-attendant-1"

// The template remains the same, assuming it represents the actual contract
const val JSON_TEMPLATE = """
{
"id": "$EVENT_ID",
Expand All @@ -110,9 +109,6 @@ class CoSyncEnrolmentRecordCreationEventDeserializerTest {
const val PLAIN_ATTENDANT = """
"attendantId": "$ATTENDANT_ID""""

// Note: Verify if "className" is the correct discriminator for your KSerializer config.
// Standard KSerialization uses "type". If your data uses "className",
// TokenizableString must be annotated with @JsonClassDiscriminator("className")
const val TOKENIZED_MODULE = """
"moduleId": {
"className": "TokenizableString.Tokenized",
Expand Down
Loading