I'm struggling to register a custom Gson configuration with my app.
It looks as if, when using
body.auto
my Gson config is not used:
val auto: CustomerCreateModel = Body.auto<CustomerCreateModel>().toLens().extract(it)
val manual: CustomerCreateModel = MyGson.mapper.fromJson(it.bodyString(), CustomerCreateModel::class.java)
assert(auto == manual) //fails
I have the following on my classpath:
object MyGson : ConfigurableGson(
GsonBuilder()
.registerTypeAdapter(Country::class.java, CountryDeserializer())
.registerTypeAdapter(Country::class.java, CountrySerializer())
.setDateFormat("yyyy MM-dd'T'HH:mm:ss.SSS'Z'")
.asConfigurable()
.withStandardMappings()
.done()
)
I'm on a fairly old version of http4k (3.261.0), btw