Skip to content

Commit

Permalink
fix: ActionWhen serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
0ffz committed Jul 28, 2024
1 parent 96284a4 commit e506c84
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.mineinabyss.geary.actions.actions.EnsureAction
import com.mineinabyss.geary.serialization.serializers.InnerSerializer
import com.mineinabyss.geary.serialization.serializers.SerializableComponentId
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.MapSerializer
import kotlin.jvm.JvmInline

Expand All @@ -30,9 +31,15 @@ class EntityObservers(
}


@JvmInline
@Serializable
value class ActionWhen(val conditions: List<EnsureAction>)
@Serializable(with = ActionWhen.Serializer::class)
class ActionWhen(val conditions: List<EnsureAction>) {
object Serializer : InnerSerializer<List<EnsureAction>, ActionWhen>(
serialName = "geary:when",
inner = ListSerializer(EnsureAction.serializer()),
inverseTransform = ActionWhen::conditions,
transform = ::ActionWhen
)
}

@JvmInline
@Serializable
Expand Down

0 comments on commit e506c84

Please sign in to comment.