Skip to content

JSON.stringify causing Maximum call stack size exceeded #4152

Closed
@pedrolourencoribeiro

Description

@pedrolourencoribeiro

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

At trainline we have a swagger schema with a bunch of loops in types ex:

type TypeA  {
    childrens: [TypeA]
}

This was causing a `Failed to generate the schema RangeError: Maximum call stack size exceeded.
I managed to track the issue to the JSON.stringify that was using the entire object.
Probably due to the cycle dependencies it has some references pointing to each other which will make the JSON.stringify recursivity to never end.

To Reproduce
Steps to reproduce the behavior:

I've added a PR that fixes it, we found it due to a complex internal swagger schema.
#4151

Expected behavior

Environment:

  • OS:
  • @graphql-mesh/...:
  • NodeJS:

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions