-
Notifications
You must be signed in to change notification settings - Fork 56
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
Idea: Redesign type definitions/code generation to avoid repetitive type definitions on server and prisma side #51
Comments
I agree. As 90% is reused, it might be convenient to set them as public by default and to add a directive like Something like:
|
I like the idea of supporting directives to decide with parts of the schema to put in the final schema part. I think the process should be similar to how The only problem is, that the prisma backend will overwrite the generated schema every time you deploy, so depending on whether or not it preserves custom directives, this might also need a change on the prisma side. @marktani Are custom directives ignored/preserved, or removed by Prisma? |
I agree with @kbrandwijk. In my case that would make things way easier. |
My current understanding is that custom directives in Can you detail how a custom directive in |
I think is solved with Prisma Nexus and can be closed. Thanks for the feedback |
Hi, I have an idea/suggestion. I find it a little bit tedious to always copy/paste my graphql datamodels from the prisma backend to the server graphql type definition file, 90% of my models are reused anyway. Wouldnt it be possible to simply add an anotation like "expose" and "private" to the prisma type definitions and their parameters and include the types in the code generation process? with default to "private", this would not change the current behavior and could be handy to quickly export the types you want to expose from prisma in a DRY manner without having to copy paste the common types all the time. additionally, it might be nice to also make overriding these in the server portion of the app a more conscious process with an "extends" or "overrides" annotation or keyword on altering type definitions.
The text was updated successfully, but these errors were encountered: