-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Resolver method to nested model not created #350
Comments
I just found out that the resolver method is created as soon as the sub entity is specified as a list in the graphql.schema. Is this a bug or is there a reason why it is like this? |
If you want a resolver method when generating models use eg:
|
Hey @vektah |
I agree with @marczahn here, I spent a pretty long time scratching my head as to how to deal with nested models, and this doesn't seem very clearly documented. Also the nested model in the example https://github.com/99designs/gqlgen/blob/master/example/starwars/schema.graphql#L33 doesn't seem to have the Could you clarify this a little @vektah ? thanks! |
Two years later, it still took me a full day of reading gqlgen docs (finding nothing) and finally Googling to find this issue and realize that generated nested models don't automatically create resolvers. @vektah @frederikhors I've seen you mention a couple places that the docs explain how to do this, but it's still VERY confusing (as can be seen by the number of confused devs opening these issues still). It seemed completely broken for me.... had no idea why it wasn't working. Maybe could update the docs to better explain what's needed to generate resolvers? I'd recommend a section describing resolver generation here (not mentioned anywhere there): https://gqlgen.com/config |
Expected Behaviour
For a relation Card -> Question I expect in the card resolver a method like
Actual Behavior
There is no method for this
Minimal graphql.schema and models to reproduce
same configuration as here
The text was updated successfully, but these errors were encountered: