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

Linting error when class has a property with the same name after snake case

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

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

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

説明

openapi-python-client: 0.21.4
Python: 3.10
OpenAPI spec version: 3.0.3

In OpenAPI specs where a property has the same name as the snake cased class name (in the example below, the snake casing is the lower case, but if it was, ex, InstagramId, then this would happen with a property named instagram_id) the code generated has a duplicated variable name (see image below).

The suggested fix is that the return variable name should have an underscore _, in this example, email_.

      "Email": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "verified": {
            "type": "boolean"
          }
        },
        "required": [
          "email",
          "type"
        ]
      },
Monosnap xeal-qa-utils – email py 2024-09-03 18-31-37

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

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

はじめの一歩

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

調査の方向性

提供された OpenAPI 3.0.3 スニペットを openapi-python-client 0.21.4 で使用して問題を再現し、生成された Email モデルを調べます。戻り値の変数とプロパティの名前を選択するジェネレーターのパスを追跡し、生成された名前が互いに衝突しなくなっていること、および例が引き続き有効な Python であることを確認します。

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

評価

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

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

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