Moritz Platt
10/07/2021, 10:00 AMbody.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), btwdave
10/07/2021, 10:03 AMBody.auto
. If you've got import org.http4k.format.Gson.auto
in your file then it's the wrong one. you need to import your method insteadMoritz Platt
10/07/2021, 10:07 AMdave
10/07/2021, 10:09 AMMoritz Platt
10/07/2021, 10:30 AM