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

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

未關閉
#881 3 則留言 3 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

🐞bug
主要語言
Python
星號
2k
分支
293
平均合併
34 分鐘
30 天內合併 PR
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. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

未指定 repository 檔案或測試。首先使用連結的 OpenAPI 規格重現產生流程,並追蹤 IF-MODIFIED-SINCE header 參數的處理;檢查字串日期在產生的 header 中如何表示。當 endpoint 能夠成功產生且不再出現 Union[Unset, datetime.date] 錯誤,並且日期 header 的表示形式已有測試時,即視為完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
api, tooling
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。