Fix #475: Incompatible date serialization default with Jackson 3 - #476
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request addresses issue #475 by restoring the historical behavior of DefaultRestClient JSON serialization for date/time values after Jackson 3 changed the default for WRITE_DATES_AS_TIMESTAMPS.
Changes:
- Force-enable timestamp-based date serialization in the
DefaultRestClientJacksonJsonMapperbuilder (to avoid ISO-8601 strings by default). - Add a regression test that verifies
java.util.Dateis serialized as numeric epoch milliseconds in POST bodies. - Add a test-only controller endpoint that echoes the raw JSON request body to make the serialization assertion reliable.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rest-client-base/src/main/java/com/wultra/core/rest/client/base/DefaultRestClient.java | Enables DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS when creating the client JsonMapper to preserve pre-Jackson-3 wire format. |
| rest-client-base/src/test/java/com/wultra/core/rest/client/base/DefaultRestClientTest.java | Adds a regression test validating numeric timestamp serialization for Date by inspecting the echoed raw request JSON. |
| rest-client-base/src/test/java/com/wultra/core/rest/client/base/controller/PublicTestRestController.java | Adds an endpoint to echo the raw JSON request body used by the new regression test. |
banterCZ
approved these changes
Aug 5, 2026
| * capturing the raw request body echoed back by the server. | ||
| */ | ||
| @Test | ||
| void testPostDateSerializesAsNumericTimestamp() throws RestClientException { |
Member
There was a problem hiding this comment.
May we please backport this test to 2.1.x just to be sure about this complicated issue?
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…te-compat' into issues/475-date-serialization-date-compat
romanstrobl
marked this pull request as ready for review
August 5, 2026 12:55
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
rest-client-base/src/test/java/com/wultra/core/rest/client/base/DefaultRestClientTest.java:310
- The assertions rely on substring matching in the echoed JSON (e.g., exact spacing and a hard-coded ISO-8601 prefix). This can make the regression test brittle if the JSON generator changes formatting (whitespace, ordering) while still serializing the date correctly. Consider parsing the echoed body as JSON and asserting that
timestampis a numeric node with the expected epoch value.
assertTrue(rawBody.contains("\"timestamp\":1785926829449"),
"Date must be serialized as numeric epoch milliseconds, was: " + rawBody);
assertFalse(rawBody.contains("2026-08-"),
"Date must not be serialized as an ISO-8601 string, was: " + rawBody);
banterCZ
approved these changes
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.