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

Part of zod methods are not available after import #25

Open
lunacrafts opened this issue Sep 22, 2022 · 5 comments
Open

Part of zod methods are not available after import #25

lunacrafts opened this issue Sep 22, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@lunacrafts
Copy link

lunacrafts commented Sep 22, 2022

Bug description

inside of ModelCreateInputObjectSchema file, I can see those properties.

Screenshot 2022-09-22 at 07 39 29

but after I import it It's undefined
Screenshot 2022-09-22 at 07 39 49

@lunacrafts
Copy link
Author

lunacrafts commented Sep 22, 2022

@omar-dulaimi omar-dulaimi added the bug Something isn't working label Oct 28, 2022
@omar-dulaimi
Copy link
Owner

Hey @lunacrafts
It's great that you managed to fix this issue, happy that it worked for you.
How do you feel about submitting a PR for this?

Also, do you think there are any side effects to exporting the schema and the type like that?

@lunacrafts
Copy link
Author

Hello @omar-dulaimi

First of all, my changes broke other part of your package, so at some point I had to resign from it (and from prisma as well), so unfortunately I'm not able to make and test PR.

Second of all, in the meantime I figured out my approach with type infering from zod would use a lot of memory during development so It's no-go solution. I don't know in-depth zod API so I'm not going to be helpful in any matter.

@omar-dulaimi
Copy link
Owner

Sad to hear that @lunacrafts
I'm sure there are other ways to fix this, especially if we ask the author of zod himself. I appreciate you taking the time to use this project, and hopefully this issue would be resolved soon.

There are alternatives to zod, like joi, yup and class validator. Maybe they could be useful to your case.

@lunacrafts
Copy link
Author

lunacrafts commented Oct 28, 2022

The real issue for me was prisma. Im in the phase of prototyping application (with mongodb) and Prisma hold me back in this case. It's great for CRUD and basic database operations, but I couldn't really use core features of mongo.

I really appreciated using prisma + prisma-zod-generator + trpc + next but I run into some limitations what made this setup of tools kinda useless. One of those is that I was able to generate awesome end-to-end typesafe queries, but I wasn't able to intercept anywhere on the backend side, so for example I couldn't apply access-control rules to resources.

It is awesome, but just not in my use case! Really appreciate your work on this package and I'm sure I'll use it in another part of project but just not yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants