Closed quintal-william closed 1 year ago
After our conversation I will remove the exports I had added back in from this PR 👌🏼
Hi @saphewilliam Tested and It seems to be great ✔ Inputs really got simpler and easier to use 🚀
I will report back to see if it is actually functioning as planned.
Its ready for merge?
I'm testing it this weekend / next week, then I'll be sure if it's ready 😄
I've tested the simple mode on a project of mine and it seems to work perfectly now! @Cauen Could you merge this PR and update the package in npm? 😄
Would be nice to have some sort of auto-publishing setup using Changesets in a github action
@saphewilliam
It seems like using PrismaUpdateOperationsInputFilter
is removing type safety from args
export const PostCreateInput = builder.inputRef<PrismaUpdateOperationsInputFilter<Prisma.PostCreateInput>>('PostCreateInput').implement({
fields: PostCreateInputFields,
});
Would be nice to have some sort of auto-publishing setup using Changesets in a github action
Thats great, i'll take a look
Edit:
Seems like its used in all inputs, but its done for update inputs only What is the point of this generic?
@Cauen
What is the point of this generic?
It matches the internal prisma type with the generated graphql endpoint.
The GraphQL schema generated from our code:
However, the Prisma schema also allows raw string inputs:
The generic strips away the raw string input to reflect the GraphQL schema better. Not doing this gave me some issues when trying to extend the generated code
Even though "set" is the only available option, I can't easily access it without doing a useless check if the arg is a string, it is in fact never a string.
This is that same code with the generic added:
I can't seem to reproduce your issue? It works fine for me
Also I did it for all inputs because it's just easier and I thought it didn't have any effect on the other inputs.
@saphewilliam Thanks for answer, looks very useful
About args
, have you tried with the example in repo?
It shows all properties, But almost everything is "any"
Its seems like a version missmatch, what is you version configs?
You're right, I think the prisma client is generating them only if necessary, so if the bool one is not used, it is not generated. Great catch! I'll fix this bug with a bit more sophisticated checking in the generic type.
I made a new generic type that should fix this issue, could you test it on your setup just to be sure? 😄
Awesome
This PR adds a "simple" mode to the input generation that uses unchecked inputs to:
All without losing much of the expressiveness of the GraphQL API.
Simple mode is enabled by setting config.inputs.simple to true, it is false by default since that would be a breaking change.
I'm testing this mode out on a personal project, I will report back to see if it is actually functioning as planned. In the meantime I'd love to hear your thoughts!