Skip to content

Commit

Permalink
Move Instant serializer to data package
Browse files Browse the repository at this point in the history
  • Loading branch information
juraj-hrivnak committed Oct 8, 2024
1 parent 8ac1a84 commit f5adf5f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package teksturepako.pakku
package teksturepako.pakku.api.data

import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
Expand All @@ -18,15 +18,14 @@ import java.time.Instant
*/
object InstantIso8601Serializer : KSerializer<Instant>
{

override val descriptor: SerialDescriptor =
PrimitiveSerialDescriptor("java.time.Instant", PrimitiveKind.STRING)

override fun deserialize(decoder: Decoder): Instant =
Instant.parse(decoder.decodeString())

override fun serialize(encoder: Encoder, value: Instant) {
override fun serialize(encoder: Encoder, value: Instant)
{
encoder.encodeString(value.toString())
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.github.michaelbull.result.Result
import com.github.michaelbull.result.get
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import teksturepako.pakku.InstantIso8601Serializer
import teksturepako.pakku.api.actions.ActionError
import teksturepako.pakku.api.actions.ActionError.ProjDiffPLinks
import teksturepako.pakku.api.actions.ActionError.ProjDiffTypes
Expand All @@ -17,7 +16,6 @@ import teksturepako.pakku.api.platforms.Multiplatform
import teksturepako.pakku.api.platforms.Platform
import teksturepako.pakku.api.platforms.Provider
import teksturepako.pakku.io.filterPath
import java.time.Instant

/**
* Represents a project. (E.g. a mod, resource pack, shader, etc.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package teksturepako.pakku.api.projects
import kotlinx.serialization.Required
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import teksturepako.pakku.InstantIso8601Serializer
import teksturepako.pakku.api.data.InstantIso8601Serializer
import teksturepako.pakku.api.actions.ActionError
import teksturepako.pakku.api.actions.ActionError.HashMismatch
import teksturepako.pakku.api.actions.ActionError.NoHashes
Expand Down

0 comments on commit f5adf5f

Please sign in to comment.