contextualRegistryElementBasedSerializers

fun SerializersModuleBuilder.contextualRegistryElementBasedSerializers()

Registers contextual serializers for RegistryEntry, RegistryEntrySet, RegistryKeySet, TagKey, and TypedKey that resolve the target registries based on the configured element serializers.

Note that this only works when resolving the serializer at runtime (e.g., via kotlinx.serialization.serializer) as otherwise the element serializer will be a kotlinx.serialization.ContextualSerializer and thus it won't be possible to infer the target registry. This means that for properties of @Serializable classes, the serializer must be specified statically (e.g., via @Serializable(with = ...)) instead of relying on contextual serialization.