openapi-generators / openapi-generators/openapi-python-client
Incorrect parsing of null as nullable enum value serialized as strings
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 2k
- フォーク
- 293
- 平均マージ
- 34分
- マージ済み PR(30日)
- 1
説明
Consider the following schema definition (which passes validation with the openapitools/openapi-generator-cli container image):
// [...]
"deviceEncryptionKeyScheme": {
"$ref": "#/components/schemas/DeviceEncryptionKeyScheme",
"nullable": true // <-- nullability declared
},
// [...]
"DeviceEncryptionKeyScheme": {
"enum": ["Default8"],
"type": "string"
},
It looks as if openapi-python-client version 0.23.1 supports deserialization with the deviceEncryptionKeyScheme property being unset, but not it being null:
_device_encryption_key_scheme = d.pop("deviceEncryptionKeyScheme", UNSET)
device_encryption_key_scheme: Union[Unset, DeviceEncryptionKeyScheme]
if isinstance(_device_encryption_key_scheme, Unset):
device_encryption_key_scheme = UNSET
else:
device_encryption_key_scheme = DeviceEncryptionKeyScheme(_device_encryption_key_scheme)
This looks like a bug to me.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
openapi-python-client 0.23.1 の動作と、示されている生成済みのデシリアライズコードを使って、issue にある nullable enum のケースを再現します。d.pop 後の deviceEncryptionKeyScheme の処理から始め、UNSET のパスと null のパスを比較します。明示的に null が設定された値が正常にデシリアライズされ、未設定のプロパティは引き続き UNSET として表現されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- openapi, python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100