In the examples there is a `resolvers.ts` file in ...
# orm-help
k
In the examples there is a
resolvers.ts
file in the
generated
folder. However, after running
prisma deploy
or
prisma generate
that file is not generated anymore. Is there a flag that I'm missing or something?
Got it
graphql-resolver-codegen
But I'm still not sure when should this run. After every deploy?
b
you should run it after each changes on schema.gql (or datamodel.gql as inherited)
anyway don't use last version because bug in npmignore, so some files are missing under ./generetors
k
Yeah I switched to a fork
But once the
/resolvers
folder is generated and it has files, you cannot override it with new files
so you basically generate the resolvers scaffold once, and then you only generate the interfaces?
b
you can use --force flag and then
git checkout -p -- resolversDir
to revert the change you don't like
not optimal at this time, more close to a POC but nice anyway
k
😐
It would be cool to add new "empty" methods for the unimplemented resolvers
Instead of rewritting the files that already have some defined resolvers
b
more than empty, generated code should be patch using TS ast 🙂
in fact, I think it already work the way you describe for new types, not for fields
k
There is so much potential for auto-codegen with Prisma + TS
👍 2
d
I will clean this up (the npmignore, build stuff) today and ping here 🙂 A few notes on the design decisions - For scaffolding, it is a 1 time process and without the -f flag we still rewrite types i.e. making TS compiler complaint about the new fields and you have to expand them manually - We thought about using TS AST and adding missing resolvers but generally whoever we spoke to suggested against it.. almost all scaffolders don't edit existing files.. we can change the folder structure to make resolvers their own files and add new files but that would be too many files. All of this is our current thought process (documented at the end of readme I think) but these are all awesome and valid points. Please feed free to raise issues for them to further discuss as slack discussions are likely to get lost 🙏
k
What you're saying makes sense
But adding an additional field, for example "surname" to a model, and then editing 30 different files is just exhausting
d
I totally understand that.. we are sort of tracking this via the 1st point here: https://github.com/prisma/graphql-resolver-codegen/issues/16 but feel free to raise a separate issue for this.. we would love to think about solutions on these lines 🙂
I cleaned it up and released a fix for the build (includes etc).
0.2.4@beta
. Sorry for the confusion 🙂
k
Great, tnx!
I gave up on using the graphql-resolver codegen ...
d
If you can document all you feedback in form of an issue, that would help. Thanks!