Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Maximum callstack issue #214

Description

Describe the bug

I have a case where a schema may return a circular dependency (even to itself) and this seems to cause a maximum callstack and/or out of memory exception. But only if a multi-level baseUri is specified.

To Reproduce

This causes an infinite loop:

  const resolver = new Resolver({
    resolvers: {
      file: {
        resolve(p) {
          return { $ref: p.toString() };
        }
      }
    }
  });
  await resolver.resolve([{ $ref: './a' }], {
    baseUri: '/root1/root2' // Change this to /root1 and it's fine
  });

Expected behavior

baseUri should support any number of nested folders.

Additional context

Just a guess, but I assume this is something related to the normalised key that's being stored as a visited node - but am unfamiliar with the code and haven't been able to dig into it yet.

Environment (remove any that are not applicable):

  • Library version: v3.1.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions