enumSerializers
Contextual serializers writing each registered enum in JSON under its PostgreSQL label, as the driver writes it in an enum column, instead of under the Kotlin constant's name.
Every conversion here folds them in already, whatever Json it was given. This is for a Json built elsewhere - an HTTP layer, a jsonb column written through the driver:
val api = Json {
serializersModule = octaviusSerializersModule + db.dynamicTypes.enumSerializers
}Content copied to clipboard
@Contextual on the property selects one; the enum needs no @Serializable. It holds the enums registered when it is read, so take it once startup has registered them all. Reading it may open a session.