Bug Report Checklist
Description
The useJackson3=false branch substitutes a default DateFormat when the argument is null. The
Jackson 3 branch passes null straight through:
{{^useJackson3}}
if (null == dateFormat) {
dateFormat = createDefaultDateFormat(); // absent from the Jackson 3 branch
}
mapper.setDateFormat(dateFormat);
{{#useJackson3}}
return JsonMapper.builder()
.defaultDateFormat(dateFormat) // null passed straight through
The parameter is still @Nullable, and the generator's own entry points call it with a hardcoded
null — buildRestClientBuilder() and buildRestClient() both do createDefaultMapper(null). With
no DateFormat set, nothing clears WRITE_DATES_AS_TIMESTAMPS, so format: date-time properties
are written as epoch numbers instead of RFC 3339. A server binding such a property to
OffsetDateTime rejects the request.
Actual vs expected output
Same model, same value, only useJackson3 flipped:
useJackson3=false (expected) : {"clientId":"client-1","issuedAt":"2026-08-01T17:30:00Z"}
useJackson3=true (actual) : {"clientId":"client-1","issuedAt":1785605400.000000000}
Worth noting for diagnosis: a client built the documented way holds two differently configured
mappers. ApiClient(RestClient) builds a correct one for its own field, while the RestClient
passed in already baked the broken one into its converter — so the client looks correctly configured
while the wire bytes are not:
apiClient.getJsonMapper() writes : "2026-08-01T17:30:00Z"
the converter's mapper writes : 1785605400.000000000
openapi-generator version
7.23.0, and still present in ApiClient.mustache on master (verified by reading the template, not by
building master). Regression relative to useJackson3=false; introduced with #23023.
OpenAPI declaration file content or url
openapi: 3.0.3
info: { title: repro, version: "1.0.0" }
paths:
/clients:
post:
operationId: createClient
requestBody:
content:
application/json:
schema: { $ref: "#/components/schemas/RegisteredClient" }
responses:
"200": { description: ok }
components:
schemas:
RegisteredClient:
type: object
properties:
clientId: { type: string }
issuedAt: { type: string, format: date-time }
Generation Details
generatorName: java
library: restclient
additionalProperties:
useSpringBoot4: "true"
useJackson3: "true"
Spring Framework 7.0.8 / Spring Boot 4, Jackson 3.1.5, Java 25.
Steps to reproduce
- Generate the spec above with the config above.
ApiClient client = new ApiClient(ApiClient.buildRestClientBuilder().build()).setBasePath(...);
createClient(...) with issuedAt populated → the request body carries an epoch number.
- Regenerate with
useJackson3=false → the same call sends "2026-08-01T17:30:00Z".
Related issues/PRs
Suggest a fix
Restore the fallback the Jackson 2 branch has:
public static JsonMapper createDefaultMapper(@Nullable DateFormat dateFormat) {
return JsonMapper.builder()
.defaultDateFormat(dateFormat != null ? dateFormat : createDefaultDateFormat())
...
Alternatively have buildRestClientBuilder() / buildRestClient() pass createDefaultDateFormat()
instead of null — though the @Nullable contract suggests the fallback belongs in the method.
Bug Report Checklist
Description
The
useJackson3=falsebranch substitutes a defaultDateFormatwhen the argument is null. TheJackson 3 branch passes null straight through:
The parameter is still
@Nullable, and the generator's own entry points call it with a hardcodednull —
buildRestClientBuilder()andbuildRestClient()both docreateDefaultMapper(null). Withno
DateFormatset, nothing clearsWRITE_DATES_AS_TIMESTAMPS, soformat: date-timepropertiesare written as epoch numbers instead of RFC 3339. A server binding such a property to
OffsetDateTimerejects the request.Actual vs expected output
Same model, same value, only
useJackson3flipped:Worth noting for diagnosis: a client built the documented way holds two differently configured
mappers.
ApiClient(RestClient)builds a correct one for its own field, while theRestClientpassed in already baked the broken one into its converter — so the client looks correctly configured
while the wire bytes are not:
openapi-generator version
7.23.0, and still present in
ApiClient.mustacheon master (verified by reading the template, not bybuilding master). Regression relative to
useJackson3=false; introduced with #23023.OpenAPI declaration file content or url
Generation Details
Spring Framework 7.0.8 / Spring Boot 4, Jackson 3.1.5, Java 25.
Steps to reproduce
ApiClient client = new ApiClient(ApiClient.buildRestClientBuilder().build()).setBasePath(...);createClient(...)withissuedAtpopulated → the request body carries an epoch number.useJackson3=false→ the same call sends"2026-08-01T17:30:00Z".Related issues/PRs
useJackson3restclient PR, where the two branches were introduced.kotlin-spring(
WRITE_DATES_AS_TIMESTAMPS), reported and fixed. Nojava/restclientequivalent filed.Companion issue:
Suggest a fix
Restore the fallback the Jackson 2 branch has:
Alternatively have
buildRestClientBuilder()/buildRestClient()passcreateDefaultDateFormat()instead of null — though the
@Nullablecontract suggests the fallback belongs in the method.