Manasseh
08/31/2023, 7:51 PMfun configureSerializationContext(): Json {
val module = SerializersModule {
contextual(EntityIDSerializer)
contextual(LocalDateTimeSerializer)
// contextual(EntityID::class) { args -> EntityIDSerializer(args[0]) }
}
return Json { serializersModule = module }
}
Then in the route where the json object is used, I'm doing something like json.encodeToString(UserSerializer.serializer(), UserSerializer(THE NECESSARY PROPERTIES))
My concern is, isn't the @Contextual annotation like a substitute for the @Serializable(with=) annotation?