-
Notifications
You must be signed in to change notification settings - Fork 117
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
InstantSerializer doesn't respect any format-related settings without replacing serializer instance #168
Comments
Yes, I would be happy to review, merge PR that adds configubility. Coverage is incomplete mostly because As to using @kupci WDYT? |
@cowtowncoder Sounds good, would this fall under the |
@kupci my first instinct is that this would probably be separate task. |
Hey guys, I will take this one. |
After taking a look at the code and the comments here, not sure if this is working already and if is needed. Please can you provide some guidance on how to proceed? thanks in advance. |
@obarcelonap the original description is bit vague, but maybe you could add a unit test(s) to show that pattern and shape overrides work (to switch between timestamp/textual, custom pattern), for serialization (since this is what issue is for)? If there are existing tests that you think covers them that's fine too, but I suspect there may be some gaps. |
I can get
|
|
Ah yes of course! Silly me. Thank you. |
InstantSerializer doesn't respect any of the following standard Jackson configuration settings:
ObjectMapper#setDateFormat
@JsonFormat(pattern)
on anInstant
others?
Instead, I have to create and manually override the default
InstantSerializer
registered by the module.This isn't well documented and is definitely confusing when using the library.
Can we make
InstantSerializer
actually respect date-related or pattern-related options from the core library?Looking at
InstantSerializerBase
, the provided context has the format from the mapper, but doesn't use it. The formatters attached to the serializer directly are both null by default.So the
SerializationFeature.WRITE_DATES_AS_TIMESTAMPS
is respected but that's it.Does it make sense to use the provider's
defaultSerializeDateValue(long timestamp, JsonGenerator gen)
method here and pass the timestamp from theInstant
?The text was updated successfully, but these errors were encountered: