americanexpress / nodes

A GraphQL JVM Client - Java, Kotlin, Scala, etc.
Apache License 2.0
307 stars 70 forks source link

Customizable object mapper #25

Closed mrchass closed 5 years ago

mrchass commented 6 years ago

I think, it would be great to be able to customize the objectmapper instance used in Fetch class. In my case i was missing jackson's java time module to use java time datatypes in my response entities.

Because Fetch class has a final class declaration i can't see any easy way to modify/replace its object mapper instance. This could be useful also in spring (boot) projects, where the environment provides a preconfigured object mapper and an easy way to provide a custom one.

For the moment i helped myself by using @JsonDeserialize annotation for java time properties of my response entities.

chemdrew commented 6 years ago

Thanks @mrchass! This has actually been something I've been tinkering with, mainly with the goal of adding support for multiple serialization libraries for lighter-weight options (especially for android development)

Pull requests and collaboration are very appreciated though!