elastic4s icon indicating copy to clipboard operation
elastic4s copied to clipboard

Codecs not 100% pluggable, hard dependency on Jackson

Open ThijsBroersen opened this issue 4 years ago • 4 comments
trafficstars

As codecs for case class instances can be chosen (e.g. Jackson, Circe, Json4s) there is still a core dependency on Jackson.

I got the following error: com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.11.4 requires Jackson Databind version >= 2.11.0 and < 2.12.0 Found the Jackson import in com.sksamuel.elastic4s.ResponseHandler

Can this also be made pluggable?

ThijsBroersen avatar Feb 08 '21 08:02 ThijsBroersen

I'd also like to have this, but having to write all codecs seems like huge effort.

KadekM avatar Mar 16 '21 09:03 KadekM

I'd like to understand why this hard dependency exists. Core libraries should/could be agnostic. In the code it looks like the 'elastic4s-json-jackson' module was written before most of the core code where later this jackson dependency was included. I currently cannot bump some libraries to their latest versions because the latest elastic4s depends on a different version of jackson than those other libraries. If it was pluggable I could just switch to a different json-library.

ThijsBroersen avatar Mar 16 '21 18:03 ThijsBroersen

You'd have to provide an implicit json serializer which we can do. I'm working on a dotty compatible version of elastic4s right now, so I can incorporate this idea into the next major release.

sksamuel avatar Mar 16 '21 19:03 sksamuel