APIDevTools / json-schema-ref-parser

Parse, Resolve, and Dereference JSON Schema $ref pointers in Node and browsers
https://apitools.dev/json-schema-ref-parser
MIT License
952 stars 227 forks source link

Immediately circular schema causes a maximum call stack trace exception #271

Closed erunion closed 6 months ago

erunion commented 2 years ago

Feeding this immediately circular API definition into the library will cause a "Maximum call stack size exceeded" exception within ref.js:

openapi: 3.0.0
info:
  version: 0.0.1
  title: Circular mishandling
servers:
  - url: https://httpbin.org
paths:
  "/anything":
    get:
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/responseSchema"
components:
  schemas:
    responseSchema:
      $ref: "#/components/schemas/responseSchema"
      description: This is a description.
xiaoxuqi-ms commented 1 year ago

Have the same problem, any progress.