Skip to content

Loading openapi schema with loop references ends-up with endless loop and crashing with "stack overflow" error #542

@panush

Description

@panush

I'm using kin-openapi v0.89.0.
when trying to load the below openapi (with a reference loop in it), kin-openapi is crashing after getting into an endless loop (see attached file)
kin-openapi-endless-loop-error.txt

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
servers:
  - url: http://petstore.swagger.io/v1
paths:
  /pets:
    patch:
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/Cat'
                - $ref: '#/components/schemas/Kitten'
              discriminator:
                propertyName: pet_type
      responses:
        '200':
          description: Updated
components:
  schemas:
    Cat:
      anyOf: 
        - $ref: '#/components/schemas/Kitten'
        - type: object
          properties:
            hunts:
              type: boolean
            age:
              type: integer
            offspring:
    Kitten: 
      $ref: '#/components/schemas/Cat'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions