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

fix (generator): fix type issue on schemas containing relations #727

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

kevin-dp
Copy link
Contributor

@kevin-dp kevin-dp commented Dec 6, 2023

This PR fixes the problem where the generated client may contain type errors for models containing relations.
This is a known problem with Zod and Prisma and is described here: chrishoermann/zod-prisma-types#98. That issue also proposes a solution with a dirty type cast: chrishoermann/zod-prisma-types#98 (comment) which is implemented in this PR.

This PR removes the need for pinning the version of Zod (#700).

To test this fix, you will need a schema containing at least one FK relation and make sure to modify the dependency to your generator to point to the modified generator (e.g. npm pack the generator and use a dependency to the packed file).

@kevin-dp kevin-dp force-pushed the kevindp/fix-zod-type-issue branch from 57d339a to 6e20d5f Compare December 6, 2023 15:36
@kevin-dp kevin-dp requested a review from samwillis December 6, 2023 15:41
Copy link
Contributor

@samwillis samwillis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, it works! 🎉

Before:
image

After:
image

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

Successfully merging this pull request may close these issues.

2 participants