openapi-generators / openapi-generators/openapi-python-client

Union[Unset, datetime.date] is not allowed in header

オープン
#881 コメント 3 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

🐞bug
主要言語
Python
スター
2k
フォーク
293
平均マージ
34分
マージ済み PR(30日)
1

説明

Describe the bug
The parameter name='IF-MODIFIED-SINCE' produces an error 'Union[Unset, datetime.date] is not allowed in header', which prevents the endpoint from being generated.

OpenAPI Spec File
https://docs.developers.clio.com/openapi.json

Desktop (please complete the following information):

  • OS: macOS 13.4.1
  • Python Version: 3.12
  • openapi-python-client version: 0.15.2

Additional context
The parameter schema is:
"schema": {
"type": "string", (the format in "YYYY-MM-DD")
"format": "date" (the format defined by full-date in RFC3339)
}
The client generator is attempting to map this schema to a Python Union type, the union of Unset and datetime.date, which is not allowed or fitting in a HTTP header. Maybe string dates need to be transformed to datetime objects and vice versa? Or the date could be converted to a string before setting the header? At least that's my limited understanding of the situation.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

リポジトリのファイルやテストは指定されていません。まず、リンクされた OpenAPI 仕様で生成を再現し、ヘッダーパラメーター IF-MODIFIED-SINCE の処理を追跡します。生成されたヘッダーで、文字列の日付がどのように表現されるかを調査してください。日付ヘッダーの表現がテストされ、Union[Unset, datetime.date] エラーなしでエンドポイントが正常に生成されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

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

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