openapi-generators / openapi-generators/openapi-python-client
date-time is not formatted correctly
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 2k
- フォーク
- 293
- 平均マージ
- 34分
- マージ済み PR(30日)
- 1
説明
Describe the bug
OpenAPI date-time fields are generated using datetime.datetime.isoformat and don't comply with OpenAPI spec / RFC3339
OpenAPI Spec File
/api/example:
get:
tags:
- "example"
operationId: example-get
summary: "summary removed"
description: ""
parameters:
- in: query
name: "start"
description: "desciption removed"
required: true
schema:
type: string
format: date-time
example: '2020-07-21T17:32:28Z'
- in: query
name: "end"
description: "desciption removed"
required: true
schema:
type: string
format: date-time
example: '2020-07-21T17:32:28Z'
Desktop:
- OS: Windows 11
- Python Version: 3.9.13
- openapi-python-client version 0.15.1
Additional context
Client code generated using openapi-python-client version 0.15.1 parses datetime.datetime objects and uses .isoformat() function to convert these to strings. This produces timestamp strings non-compliant with OpenAPI spec (https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#data-types). According to spec timestamps should look like this:
2023-08-23T13:26:16Z
Instead they look like this:
2023-08-23T12:26:16.979067
I have a server that rejects these as invalid timestamps. I can patch the client manually after generation, but I thought it would be beneficial to submit a bug report.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、datetime.datetime 値を処理して isoformat() を呼び出す、生成されたクライアントリクエストのシリアライズ処理を見つけます。その出力を issue にある RFC3339/OpenAPI の例と比較し、date-time クエリパラメータのテストを実行するか、テストカバレッジを追加します。生成されたタイムスタンプが、報告されたサーバーによって準拠した date-time 値として受け入れられれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- openapi, python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100