stoplightio / json-schema-tree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

porotkin opened this issue · comments

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: -

@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

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

🎉 This issue has been resolved in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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