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

Unable to parse schema definition with anyOf/allOf within one another

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

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

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

説明

Describe the bug

Schema definition in components of combined schemas are failing to be parsed, with the following error:

Unable to parse this part of your OpenAPI document: : Invalid property in union /components/schemas/composite_object

Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type=None, allOf=[Reference(ref='#/components/schemas/simple_object1'), Reference(ref='#/components/schemas/simple_object2')], oneOf=[], anyOf=[], schema_not=None, items=None, properties=None, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)

Surprisingly, combined schemas are correctly parsed when defined in paths : this is the uncommented part in the gist.

OpenAPI Spec File
A link to an OpenAPI document which produces this issue. Ideally, write a minimal reproduction only containing the problematic pieces.

Desktop (please complete the following information):

  • OS: Amazon Linux 2
  • Python Version: 3.11.5
  • openapi-python-client version 0.15.2

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

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

はじめの一歩

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

調査の方向性

リンクされた OpenAPI gist を使って失敗を再現し、anyOf/allOf をネストする components 内のスキーマに焦点を当て、その後、その経路を paths 配下で機能しているスキーマ処理と比較します。両方のケースの parser のエントリーポイントを追跡します。完了の条件は、component のスキーマがパースされ、invalid-property エラーなしでクライアント生成が成功することです。

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

評価

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

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

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