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

All fields are getting added to required #107

Closed
Dhruv-Garg79 opened this issue Feb 27, 2024 · 1 comment
Closed

All fields are getting added to required #107

Dhruv-Garg79 opened this issue Feb 27, 2024 · 1 comment

Comments

@Dhruv-Garg79
Copy link

		zodToJsonSchema(z.object({ message: z.string(), data: schema.response.deepPartial() }), {
			$refStrategy: 'none',
		}) as any,

I am using the above code for creating JSON schema for zod schema where all fields are optional. But this code is not working anymore. I tried earlier versions of zod-to-josn-schema, but it's still not working

@Dhruv-Garg79
Copy link
Author

I found the issue, it seems to be with the zod itself. when we use .and in zod schema it makes fields as required, but when we use .augment it works as expected

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