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

Abierto
#400 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
openapi, python
Área
api, testing-qa

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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?

Lenguaje dominante
Python
Estrellas
409
Forks
73
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de python-openapi/openapi-spec-validator

Todos los issues de python-openapi/openapi-spec-validator

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.