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

$ref in path parameters doesn't seem to work

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

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

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

説明

Describe the bug
If a get path has a parameter using $ref to point to #/components/parameters, the generated API lacks the corresponding kwarg. If one "hoists" the indirect parameter up into the path's parameters, it works as expected.

To Reproduce
See this repo for a reproducible example.
And see this repo for the same schema without the $ref, working as expected.

Expected behavior
I expect to see the optional page kwarg in both generated APIs.

I see this in the $ref example:

def sync(
    *,
    client: Client,
) -> Optional[List[str]]:

and this in the noref example:

def sync(
    *,
    client: Client,
    page: Union[Unset, None, GetTestPage] = UNSET,
) -> Optional[List[str]]:

OpenAPI Spec File
A link to your openapi.json which produces this issue.

Desktop (please complete the following information):

  • OS: Microsoft Windows 10 Pro 10.0.19044 Build 19044
  • Python Version: 3.9.12
  • openapi-python-client version 0.11.1

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

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

はじめの一歩

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

調査の方向性

再現可能な openapi-ref-issue リポジトリにリンクされている test-schema.yaml から始め、報告されている openapi-python-client のバージョンを使ってジェネレーターを実行します。生成された sync エントリポイントを noref の例と比較し、パラメーター $ref の解決に注目します。参照されたパラメーターの場合にも、生成された API にオプションの page kwarg が含まれていれば完了です。

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

評価

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

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

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