AtFieldSerializer

class AtFieldSerializer<T : Any>(inner: KSerializer<T>) : KSerializer<AtField<T>>

Generic serializer for AtField values. The compiler plugin wires inner automatically when the field type is resolved (e.g. AtField<String> picks up String.serializer()).

On decode: any time this serializer is invoked, the field key was present in the input (otherwise kotlinx-serialization would have used the default param and never called us). We inspect the element: JsonNull becomes AtField.Null, anything else becomes AtField.Defined wrapping the inner-decoded value.

On encode: AtField.Null emits a JSON null token, AtField.Defined delegates to inner, and AtField.Missing is an error — it should have been filtered out by @EncodeDefault(NEVER) on the field (or by the global encodeDefaults = false) before reaching us.

JSON-only: deserialize casts the decoder to JsonDecoder to inspect the raw element. V1 is JSON/XRPC-only; a CBOR path can be added later without breaking the public surface.

Constructors

Link copied to clipboard
constructor(inner: KSerializer<T>)

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): AtField<T>
Link copied to clipboard
open override fun serialize(encoder: Encoder, value: AtField<T>)