octaviusSerializersModule
The contextual serializers for the four types whose JSON form does not match their column form.
Every one of them is a type the driver already maps correctly in a column of its own, and gets wrong the moment the same value goes through JSON instead - a numeric rounded to a Double, an unbounded date written as the year 999999999. A dynamic_dto payload and a jsonb column are both JSON, so both are where that happens.
BigDecimal through BigDecimalAsNumberSerializer, keeping the digits and the JSON number type.
LocalDate, LocalDateTime and Instant through the
WithInfinityserializers, keeping PostgreSQL'sinfinityand-infinity.
Contextual, so it changes nothing until a property asks for it:
@Serializable
@DynamicallyMappable("land_grant")
data class LandGrant(
val province: String,
@Contextual val iugera: BigDecimal,
@Contextual val until: LocalDate
)The client's own dynamicJson already carries it, so a payload written through Octavius needs nothing added. This is for the Json built elsewhere - the frontend that reads the same class, or an HTTP layer that has one of its own:
val json = Json {
serializersModule = octaviusSerializersModule + myAppModule
ignoreUnknownKeys = true
}See also
for the case where the module is the only thing being configured.