Skip to content
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

Use SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS for configuring Duration serialization #75

Closed
wants to merge 1 commit into from

Conversation

kezhuw
Copy link

@kezhuw kezhuw commented May 27, 2018

The current implementation uses WRITE_DATES_AS_TIMESTAMPS and ignores WRITE_DURATIONS_AS_TIMESTAMPS totally.

I thought it would be less surprising to use WRITE_DURATIONS_AS_TIMESTAMPS for time duration serialization.

@cowtowncoder cowtowncoder changed the title Use WRITE_DURATIONS_AS_TIMESTAMPS for time duration serialization Use SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS for configuring Duration serialization Sep 13, 2018
@cowtowncoder cowtowncoder added this to the 2.10.0 milestone Sep 13, 2018
cowtowncoder added a commit that referenced this pull request Sep 13, 2018
cowtowncoder added a commit that referenced this pull request Sep 13, 2018
@cowtowncoder
Copy link
Member

Thank you for submitting this PR! Since this changes observed behavior, it needed to go in a new minor version, and now that I branched 2.10 I was able to merge the suggested change in manually.

One other thing that might be worth considering is whether handling of Period should also allow timestamp notation (and if so, feature to use should have same as with Duration. But since timestamps are not yet supported that's separate issue.

Thank you again for the improvement; this will be in 2.10.0 once that gets released.

filiphr added a commit to filiphr/spring-boot that referenced this pull request Dec 11, 2019
… default

Jackson added a breaking change in 2.10 for the way Duration is serialized.
Before that the DurationSerializer was using SerializationFeature.WRITE_DATES_AS_TIMESTAMPS
to check whether Duration should be serialized as a timestamp or not.

Since 2.10 Jackson uses SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS
to check whether Duration should be serialized as a timestamp or not.

This commit aligns the default for SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS
with the default for SerializationFeature.WRITE_DATES_AS_TIMESTAMPS

The change in Jackson was done in FasterXML/jackson-modules-java8#75

fixes spring-projectsgh-19345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants