-
Notifications
You must be signed in to change notification settings - Fork 207
enable jackson ObjectMapper
JDK8 & JSR310 modules + module autodetect
#1614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
enable jackson ObjectMapper
JDK8 & JSR310 modules + module autodetect
#1614
Conversation
bf4e826
to
6a945e1
Compare
@rursprung AFAIK none of the OpenSearch Java APIs expose or use |
@reta: see the provided test: it's not about what |
@rursprung two things here:
To summarize, the serde of date/time fields needs care, there is no default we could / should use, I believe the users should add the serde manually (and if the standard work for them - even better, register module(s) or delegate to framework like Spring) |
i agree. but JDK8 data types are part of the core language.
this is a different topic. what you're linking to is about indexing text which then gets parsed as dates. what i'm talking about is indexing native java date/time values
i disagree with you on this: these are standard if - after re-considering my arguments 😉 - you're still completely against adding the JDK8 & JSR310 modules as dependencies: would you at the very least accept adding the module autodetection to |
Sorry for delay @rursprung , I think adding |
jackson 2.x still supports java 7 and thus does not automatically support java 8 classes. this will change with jackson 3.x (see e.g. this [PR adding JSR310 date support] to 3.x). PR opensearch-project#251 added documentation on how a custom `ObjectMapper` can be registered - but there's no reason why we can't just enable auto-detection centrally. the docs mention that performance should be considered, but this is IMHO not relevant here since we only construct it once and then keep the same `ObjectMapper` (which in turn the docs mention as best practices). Signed-off-by: Ralph Ursprung <Ralph.Ursprung@avaloq.com> [PR adding JSR310 date support]: FasterXML/jackson-databind#5032
without these various core java types introduced with JDK8 (more than a decade ago!) are not usable. we should enable them centrally so that not everyone has to do this manually. note that with jackson 3.x this will no longer be needed as it includes it by default: FasterXML/jackson-databind#982 Signed-off-by: Ralph Ursprung <Ralph.Ursprung@avaloq.com>
6a945e1
to
c834c14
Compare
i've now split the first commit out into #1643 |
Description
see the individual commit messages for further details.
short summary: this makes using core java types introduced 10+ years ago possible without having to resort to manual workarounds on the client side.
with jackson 3.x this will work out of the box since they've included the modules there. jackson 3.0 will probably be released soon, since RC5 is already out; though how/when
opensearch-java
will upgrade to this is unclear to me since it's part of the public API (and you just did a major release).Issues Resolved
n/a
though this relates to #250 & #251
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.