[BUG][RUST] chrono date-time path/query/header params are not serialized as RFC 3339
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- openapi, rust
- Domain
- developer-experience, tooling
Research direction
Start with the Rust templates that generate src/apis/default_api.rs for the rust generator and the reqwest, reqwest-trait, and hyper libraries. Find the path, query, and header serialization sites where chrono DateTime values currently use Display or .to_string(), while leaving NaiveDate unchanged. Generate the client from the provided spec and verify those three parameter locations emit RFC 3339 values; existing Rust generator tests should cover the regression.
Written by the indexing model from the issue text.
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
Description
With the rust client generator and useChrono=true (the default), format: date-time parameters are typed chrono::DateTime<chrono::FixedOffset>. Path, query and header params of that type are turned into strings with Display (.to_string() / format!), and chrono's Display is not RFC 3339:
GET /orders/2026-01-02%2003:04:05%20+00:00?createdAfter=2026-01-02+03%3A04%3A05+%2B00%3A00
x-request-time: 2026-01-02 03:04:05 +00:00
Expected (RFC 3339, the same format serde uses for these values in bodies):
GET /orders/2026-01-02T03:04:05+00:00?createdAfter=2026-01-02T03%3A04%3A05%2B00%3A00
x-request-time: 2026-01-02T03:04:05+00:00
Servers that strictly parse date-time reject the request. This affects the reqwest, reqwest-trait and hyper libraries. format: date (chrono::NaiveDate) is not affected, because its Display is already YYYY-MM-DD.
openapi-generator version
master (7.27.0-SNAPSHOT). Not a regression: it has been this way since chrono support was added.
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: date-time params
version: 1.0.0
paths:
/orders/{since}:
get:
operationId: listOrders
parameters:
- name: since
in: path
required: true
schema:
type: string
format: date-time
- name: createdAfter
in: query
required: true
schema:
type: string
format: date-time
- name: X-Request-Time
in: header
required: false
schema:
type: string
format: date-time
responses:
'204':
description: No content
Generation Details
java -jar openapi-generator-cli.jar generate -g rust --library reqwest -i spec.yaml -o out
The same happens with --library reqwest-trait and --library hyper.
Steps to reproduce
- Generate the client from the spec above.
- Look at
src/apis/default_api.rs:since=p_path_since,&p_query_created_after.to_string(),.header("X-Request-Time", param_value.to_string()). - Call
list_orderswithDateTime::parse_from_rfc3339("2026-01-02T03:04:05Z")and inspect the request: the values are sent as2026-01-02 03:04:05 +00:00.
Related issues/PRs
#23451 (added chrono support to the rust client)
Suggest a fix
For chrono DateTime path, query and header params, use .to_rfc3339() instead of Display.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 145
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenAPITools/openapi-generator
-
[BUG][RUST] Reqwest - encoding of spaces in path parametersPossibly taken @GlenWright claimed this 3 days ago. OpenIssue: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenAPITools/openapi-generator#25257 · 3 comments ·
Maintainers usually reply within 1 day
-
[BUG] ExampleGenerator returns the string "{}" (or null) for `type: object` schemas without `properties`Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenAPITools/openapi-generator#25237 ·
Maintainers usually reply within 1 day
-
[BUG] OpenApiEvaluator reports "default value not in enum" for numerically equal values with different scale (e.g. 1.5 and 1.50)Possibly taken @mohitduhan19 claimed this 5 days ago. OpenIssue: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenAPITools/openapi-generator#25233 ·
Maintainers usually reply within 1 day
-
[BUG] OpenApiEvaluator emits "Unused model" warnings even when recommendations are disabledPossibly taken @mohitduhan19 claimed this 5 days ago. OpenIssue: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
OpenAPITools/openapi-generator#25232 ·
Maintainers usually reply within 1 day
-
[BUG][KOTLIN] multiplatform/jvm-ktor: `DELETE` without `requestBody` sends `"Content-Type: application/json"` with an empty bodyPossibly taken @mohitduhan19 claimed this 5 days ago. OpenIssue: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenAPITools/openapi-generator#25223 ·
Maintainers usually reply within 1 day
All issues in OpenAPITools/openapi-generator
Similar issues
-
BC remittance upload: a claim MSP refused (S03) is saved with a blank status instead of refused (F)Opentype: bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
carlos-emr/carlos#4933 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Vakore/ZappierGames#147 ·
-
spigotmc
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Dans-Plugins/Wild-Pets#356 ·
Maintainers usually reply within 1 day
-
spigotmc
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Dans-Plugins/Medieval-Roleplay-Engine#371 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
eddyizm/tempus#1220 · 1 comment ·
Maintainers usually reply within 2 days