Skip to content

v4: parse and safeParse no longer accept path in params #4128

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

Open
arg0NNY opened this issue Apr 12, 2025 · 1 comment
Open

v4: parse and safeParse no longer accept path in params #4128

arg0NNY opened this issue Apr 12, 2025 · 1 comment

Comments

@arg0NNY
Copy link

arg0NNY commented Apr 12, 2025

This was helpful when validating some specific deeply-nested properties inside an object without worrying about manually altering the path in the root and union issues for it to be a valid path relative to the root object and just simply handling issues as-is.

Here's the ParseParams interface in v3 used by parse and safeParse:

export type ParseParams = {
path: (string | number)[];
errorMap: ZodErrorMap;
async: boolean;
};

I couldn't find any mentions of this change in the migration guide so I assume it was unintentional.

@arg0NNY
Copy link
Author

arg0NNY commented Apr 13, 2025

Also, path is no longer available inside transforms and refinements' ctx, which was crucial for recursive types to make validations based on the current path. Notify me if I should create a separate issue for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant