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

RangeError: maximum stack size exceeded error (refers to #18) #19

Closed
porotkin opened this issue Dec 1, 2022 · 4 comments · Fixed by #25
Closed

RangeError: maximum stack size exceeded error (refers to #18) #19

porotkin opened this issue Dec 1, 2022 · 4 comments · Fixed by #25
Labels
bug Something isn't working released

Comments

@porotkin
Copy link

porotkin commented Dec 1, 2022

Due to the recent changes, when the schema is being defined as a ref to itself (recursive) with an overridden description property, it causes the StackOverflow error in json-schema-tree.

Example:

Cat:
  type: object
  properties:
    parents:
      type: array
      items:
        $ref: '#/components/schemas/Cat'
        description: Cat's parents

Context

This causes the Error: Stack size exceeded rendering on HttpOperation node where such schema is referenced

Current Behavior

image

Expected Behavior

The schema is rendered correctly and doesn't make the page to load till the stack size is exceeded (provoking the browser page unresponsiveness)

Possible Workaround/Solution

#18 caused this
newFragment = { ...newFragment }; - this is the line in walker.js file causing the referential inequality that later as far as I grasped leads to the infinite ref resolving

Steps to Reproduce

  1. just copy such schema to any existent OAS specification and try to open it in Elements

Environment

  • Version used: 2.2.2
  • Environment name and version (e.g. Chrome: 39, node.js: 5.4): Chrome latest
  • Operating System and version (desktop or mobile): macOS
  • Link to your environment/workspace/project: -
@porotkin
Copy link
Author

porotkin commented Dec 1, 2022

@P0lip, please, help with the issue. I see the only one solution at the moment - it's not to clone the object. But as you've mentioned in #18, it's a bad thing and can probably lead to funky behavior

@tintin92350
Copy link

Hello ! We still have this problem. Has anyone found a solution?

Copy link

🎉 This issue has been resolved in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@P0lip
Copy link
Contributor

P0lip commented Nov 16, 2023

@porotkin #25 should address your issue.
LMK in case it's still broken.

@P0lip P0lip reopened this Nov 16, 2023
@P0lip P0lip closed this as completed Nov 16, 2023
@P0lip P0lip added the bug Something isn't working label Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
3 participants