Possible Regression: RecursionError validating oneOf/allOf schema in 0.7.2 (works in 0.7.1)

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

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

評価

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

調査の方向性

Start by running the supplied validate.py reproduction with openapi-spec-validator 0.7.2, then compare it with 0.7.1 as shown. Trace the RecursionError from the validate(parsed_spec) entry point through the oneOf/allOf and $ref schema validation, and consider the issue done when the reproduction validates successfully without recursion failure while preserving the 0.7.1 result.

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

説明

Summary

An OpenAPI 3.1 schema that validated fine with openapi-spec-validator 0.7.1 now fails with a RecursionError in 0.7.2

Environment

openapi-spec-validator | 0.7.2 ❌ / 0.7.1 ✅
uv 0.7.3 (3c413f74b 2025-05-07)

Minimal reproduction

# validate.py
# /// script
# requires-python = ">=3.12"
# dependencies = [
#    "openapi-spec-validator==0.7.2" # TODO: test with 0.7.1
# ]
# ///


import yaml
from openapi_spec_validator import validate

openapi_spec = """
openapi: 3.1.0
info:
  title: Recursion Bug Demo
  version: 0.1.0
components:
  schemas:
    PropertyConstraint:
      type: object
      oneOf:
        - $ref: '#/components/schemas/PropertyEqualityConstraint'
        - $ref: '#/components/schemas/PropertyRangeConstraint'
      properties:
        property_id:
          type: string
        type:
          type: string
      required: [type]

    PropertyEqualityConstraint:
      allOf:
        - $ref: '#/components/schemas/PropertyConstraint'
        - type: object
          properties:
            property_id:
              type: string
            property_value: {}
          required: [property_id, property_value]

    PropertyRangeConstraint:
      allOf:
        - $ref: '#/components/schemas/PropertyConstraint'
        - type: object
          properties:
            property_id:
              type: string
            min: {}
            max: {}
          required: [property_id, min, max]
"""


parsed_spec = yaml.safe_load(openapi_spec)
validate(parsed_spec)
print("valid")

> uv run validate.py
RecursionError: maximum recursion depth exceeded

Set the version to 0.7.1 in the uv script tag at the top.

> uv run validate.py
valid

Has anyone else observed this behaviour?

主要言語
Python
スター
409
フォーク
73
PR マージ指標
30日以内にマージされた PR はありません

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

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

はじめの一歩

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

python-openapi/openapi-spec-validator のほかの issue

python-openapi/openapi-spec-validator の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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