[BUG][RUST] chrono date-time path/query/header params are not serialized as RFC 3339
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- openapi, rust
調査の方向性
rust ジェネレーターと reqwest、reqwest-trait、hyper ライブラリ向けの src/apis/default_api.rs を生成する Rust テンプレートから始める。chrono の DateTime 値が現在 Display または .to_string() 使用的是、path、query、header のシリアライズ箇所を特定する。ただし NaiveDate は変更しない。提供された仕様からクライアントを生成し、その3つのパラメーター箇所が RFC 3339 値を出力することを確認する。既存の Rust ジェネレーターのテストで回帰をカバーできるはずだ。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 26.8k
- フォーク
- 7.7k
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 166
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenAPITools/openapi-generator のほかの issue
-
Enhancement: Feature
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenAPITools/openapi-generator#25364 ·
メンテナーはふだん 1 日以内に返信
-
[BUG][RUST] Reqwest - encoding of spaces in path parameters対応中かも @GlenWright が 11 日前に担当しました。 オープンIssue: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
OpenAPITools/openapi-generator#25257 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenAPITools/openapi-generator#25237 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] OpenApiEvaluator reports "default value not in enum" for numerically equal values with different scale (e.g. 1.5 and 1.50)対応中かも @mohitduhan19 が 12 日前に担当しました。 オープンIssue: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OpenAPITools/openapi-generator#25233 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] OpenApiEvaluator emits "Unused model" warnings even when recommendations are disabled対応中かも @mohitduhan19 が 12 日前に担当しました。 オープンIssue: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
OpenAPITools/openapi-generator#25232 ·
メンテナーはふだん 1 日以内に返信
OpenAPITools/openapi-generator の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
code-maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
krizaka/krizaka-notifications#32 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
klikli-dev/occultism#1719 ·