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

The `deprecated` field from OpenAPI operations is parsed but not exposed to templates

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

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

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

説明

Describe the bug

The deprecated field on OpenAPI operation objects is parsed into the Operation schema model (operation.py#L31), but it is never carried over to the Endpoint dataclass that is passed to Jinja templates (openapi.py#L132-L152).

This means there is no way to check endpoint.deprecated in a custom template to conditionally emit deprecation warnings, docstring annotations, or @deprecated decorators.

The Endpoint dataclass is missing a deprecated: bool field, and the constructor at openapi.py#L419-L427 does not pass data.deprecated through.

Expected behavior

The Endpoint dataclass should include a deprecated: bool = False field, populated from data.deprecated during construction, so that templates can use {% if endpoint.deprecated %} to customize output for deprecated operations.

OpenAPI Spec File

Any spec with a deprecated operation, for example:

paths:
  /example:
    get:
      operationId: getExample
      deprecated: true
      responses:
        '200':
          description: OK

Desktop (please complete the following information):

  • OS: macOS 26.3
  • Python Version: 3.9.6
  • openapi-python-client version: 0.28.2

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

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

はじめの一歩

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

調査の方向性

openapi_python_client/schema/openapi_schema_pydantic/operation.py の Operation モデルと、openapi_python_client/parser/openapi.py の Endpoint dataclass およびコンストラクターから始めます。operation のデータが Jinja テンプレートに渡される Endpoint にどのように到達するかを追跡し、その後、deprecated な operation が endpoint.deprecated を公開し、指定されていない場合はデフォルトで false になることを確認します。

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

評価

技術スタック
python
領域
tooling
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
58/100

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

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