Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[BUG][RUST] chrono date-time path/query/header params are not serialized as RFC 3339

オープン 初心者向け
#25,297 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@teovillanueva がすでに取り組んでいます。

2026年10月17日 から。

  • #25298 @teovillanueva による — オープン

評価

難易度
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
  1. Generate the client from the spec above.
  2. 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()).
  3. Call list_orders with DateTime::parse_from_rfc3339("2026-01-02T03:04:05Z") and inspect the request: the values are sent as 2026-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

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenAPITools/openapi-generator のほかの issue

OpenAPITools/openapi-generator の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。