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

overriding model property with more specific object type doesn't work

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

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

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

説明

Describe the bug
When an object schema derives from another object schema using allOf, and redeclares a property that had an object type to use a different object type, the generated code uses the old type for that property.

OpenAPI Spec File
https://gist.github.com/eli-bl/d5658d6714e1c9ef544ef1fc8902960a

With this example, the type of SpecialTask.result in the generated code should be SpecialTaskOutputData. Instead it is being declared as BaseTaskResult, the same as BaseTask.result.

Desktop (please complete the following information):

  • OS: macOS 14.5
  • Python Version: 3.8.15
  • openapi-python-client version: 0.21.5

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

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

はじめの一歩

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

調査の方向性

まず、レポートにリンクされている OpenAPI 仕様で問題を再現し、BaseTask と SpecialTask の生成モデルを調べます。継承されたオブジェクトプロパティと再宣言されたオブジェクトプロパティがどのように解決されるかを追跡します。SpecialTask.result が BaseTaskResult ではなく SpecialTaskOutputData 型で生成されれば完了です。

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

評価

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

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

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