Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A $ref containing a link causes "Maximum call stack size exceeded" #2300

Open
mary-ehlers opened this issue Dec 15, 2022 · 2 comments
Open

Comments

@mary-ehlers
Copy link

Context

This bug can be reproduced with the following simple OpenAPI spec:

---
openapi: 3.1.0
info:
  title: blah blah
  version: 29
paths:
  /api:
    get:
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                $ref: https://spec.openapis.org/oas/3.1/schema-base/latest

Attempting to render the above with the HTML suggested here fails with the following console messages:

web-components.min.js:2 Could bundle: Maximum call stack size exceeded
(anonymous)                 @web-components.min.js:2
Promise.catch (async)	
(anonymous)                 @web-components.min.js:2
as                          @web-components.min.js:2
El                          @web-components.min.js:2
t.unstable_runWithPriority  @web-components.min.js:2
qo                          @web-components.min.js:2
bl                          @web-components.min.js:2
(anonymous)                 @web-components.min.js:2
M                           @web-components.min.js:2
x.port1.onmessage           @web-components.min.js:2

By removing the last line of the API spec, it renders fine, so the problem would appear to be specifically in the line

$ref: https://spec.openapis.org/oas/3.1/schema-base/latest

Environment

  • Version used: Whatever is live today, Dec 15, 2022
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Chrome 108.0.5359.94
  • Operating System and version (desktop or mobile): Ubuntu 20.04
@tgalopin
Copy link

tgalopin commented Jan 9, 2023

I have the same issue with local references:

"200": {
    "description": "The address details",
    "content": {
        "application\/json": {
            "schema": {
                "$ref": "#\/components\/schemas\/App_Application_Transformer_Address_AddressTransformer"
            }
        }
    }
}

@blanquer
Copy link

I believe this is due to: stoplightio/json-schema-tree#19 (which doesn't seem to have traction)

I've tried to get a schema that crashes elements like that, then manually delete the overriden "description"s of from those schemas from the JSON file, and observed that after doing that, it the stack crash disappears and the document can be rendered without an issue.

I would love for this to be solved as well as this makes it unusable for us, despite the schemas being perfectly fine.

@mnaumanali94 mnaumanali94 added t/bug Something isn't working p/medium and removed p/medium labels Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants