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 schema generation for prisma preview feature - fullTextSearch #62

Merged

Conversation

Shahidul1004
Copy link
Contributor

Hi @omar-dulaimi, thanks for creating this awesome project. I would like to integrate a fix that is related to prisma preview feature.

References

https://www.prisma.io/docs/concepts/components/prisma-client/full-text-search

Description

If we use fullTextSearch (one of the preview features prisma offers) with MySQL or PostgreSQL, then prisma exports UserOrderByWithRelationAndSearchRelevanceInputObjectSchema instead of UserOrderByWithRelationInputObjectSchema.
Screenshot from 2022-12-08 20-01-02
Screenshot from 2022-12-08 20-02-00

But in the transformer class while generating model schemas, currently we statically import the UserOrderByWithRelationInputObjectSchema. So I have added a resolve function that will return an import and zod-schema-line(like we do for include and select field) for orderBy field.

@omar-dulaimi
Copy link
Owner

Hey @Shahidul1004 thanks for the PR!
I'm facing this issue:

image

For the same schema in the repo.

@Shahidul1004
Copy link
Contributor Author

Could you please share what the problem is here? Because I am not getting any issues.

  1. From the screenshot you provide, I assume the generator does not generate the file UserOrderByWithRelationInput. Sometimes vs code fails to track new files. Could you please restart the vs code and see if it gets solved? I also face this issue.
  2. If that's not the case, could you please confirm which file the generator actually generating after looking into the objects folder? Is it generating any of these two files(UserOrderByWithRelationInput or UserOrderByWithRelationAndSearchRelevanceInputObjectSchema)? Or no file is being generated at all?

@omar-dulaimi
Copy link
Owner

Hey @Shahidul1004
I'll get back to you on this and other issues very soon. Just trying to get tRPC v10 released today :)

@omar-dulaimi
Copy link
Owner

All good!

@omar-dulaimi omar-dulaimi merged commit 9c071a1 into omar-dulaimi:master Dec 24, 2022
@omar-dulaimi
Copy link
Owner

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