gqlgen
gqlgen copied to clipboard
Update eagerly fetching section
This fixes the docs so that the generate command will correctly generate the User resolver.
Discussions about this can be found here https://github.com/99designs/gqlgen/discussions/2146 and here https://github.com/99designs/gqlgen/discussions/2144
I have:
- [x] Updated any relevant documentation (see docs)
This is not a solution. Please read carefully the docs and other issues and questions.
This is not an issue at all.
@frederikhors I'm not sure what you mean. The docs in the https://gqlgen.com/getting-started are incorrect, specifically the https://gqlgen.com/getting-started/#dont-eagerly-fetch-the-user. If you compare code snippets to the code in the completed tutorial here https://github.com/vektah/gqlgen-tutorials/tree/master/gettingstarted you can see that they are clearly different.
Coverage remained the same at 74.628% when pulling 47ab3e1c9c44801b95918017c7be2961dc785e12 on theverything:fix-getting-started-docs into 3228f36fec50930483801b27b92658592fab5e87 on 99designs:master.
Can you compare your fix with #2157 and see if it addresses your concern fully?
@StevenACoffman it does not. The PR does not address the issue properly nor does it address all of the issues.
Adding the resolver section to the gqlgen config is not necessary because once you update the Todo
struct with the UserID
instead of the User
field, gqlgen will create the resolver for you.
This is not needed.
Todo:
fields:
user:
resolver: true
Its also missing the update the the CreateTodo
function that is included in my PR.
@theverything, in gqlgen there are two different ways to do this. And they are both in docs.
@frederikhors @StevenACoffman After the user finishes the the tutorial their code should look exactly like the code in the link referenced in the tutorial itself. Found here
https://github.com/99designs/gqlgen/blob/master/docs/content/getting-started.md?plain=1#L15
@frederikhors I understand there is multiple ways to create a resolver but why have the user use both solutions when only one is necessary
I was confused by the getting-started eager-fetching section as well. I came upon this PR while searching around to see if others were confused as well.
While searching around, this issue comment got me to look closer at the github README and see the explanation about the two different eager-fetching solutions. I haven't found this info yet on https://gqlgen.com docs. That particular README section and the link to the completed tutorial code cleared up this topic for me.