OperationResponseSerializer

object OperationResponseSerializer : JsonContentPolymorphicSerializer<OperationResponse>

Custom polymorphic serializer for OperationResponse that preserves the "type" field as a property.

The Horizon API uses the "type" field for both:

  1. Type discrimination (which subclass to deserialize)

  2. A regular data property that applications need

Standard kotlinx.serialization polymorphic mechanisms don't support this dual use. This custom serializer reads the "type" field to determine the subclass while preserving it in the deserialized object.

See also

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
override fun deserialize(decoder: Decoder): OperationResponse
Link copied to clipboard
override fun serialize(encoder: Encoder, value: OperationResponse)