Skip to content
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

conform does strict validation inspite of schema.passthrough() #854

Open
IgnisDa opened this issue Jan 22, 2025 · 2 comments
Open

conform does strict validation inspite of schema.passthrough() #854

IgnisDa opened this issue Jan 22, 2025 · 2 comments

Comments

@IgnisDa
Copy link

IgnisDa commented Jan 22, 2025

Describe the bug and the expected behavior

I have the following schema:

const schema = z.object({
	email: z.string().email(),
	message: z.string(),
});

But my FormData contains the following fields:

{"email": "email@email.com","message":"msg1","honeypot":"val"}

It seems like conform does strict validation on the schema. Ideally, I would like it to ignore the fields that are not in the schema. Instead i get honeypot: expected never: got string.

Would it be possible to add an option to parseWithZod to support non strict schemas?

Conform version

v1.2.2

Steps to Reproduce the Bug or Issue

As described above.

What browsers are you seeing the problem on?

No response

Screenshots or Videos

No response

Additional context

No response

@Mat-moran
Copy link

Hi, I also notice this. In previous versions this wasn't the default behaviour. It is expected to be this the new behaviour or is a bug in the newer versions?

Thanks and regards

@edmundhung
Copy link
Owner

In previous versions this wasn't the default behaviour.

Interesting. I don't think there is any changes made on our side for a while. I wonder if this is a change on the zod side. Which zod version are you using?

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

3 participants