Skip to content

Stack overflow when using deepEqual() on mutually recursive Zod schemas (infinite traversal of z.lazy graph) #540

@szalapi

Description

@szalapi

Hey,
Great work on this tool! I wanted to give it a try (deepEqual especially), but with our deeply nested schema it resulted in stack overflow. Error description below:

Calling a deepEqual on a large, mutually recursive object schemas results in RangeError: Maximum call stack size exceeded.
Seems like the walker expands every z.lazy reference and re-enters previously seen schema nodes without effective cycle termination, causing recursion.

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