Automatically create resolvers for all fields
What happened?
Currently to create a resolver for field you have to explicitly set this in the config file like this
Todo:
fields:
user:
resolver: true
What did you expect?
Is there any way to by default create resolvers for all fields in the schema. Wether they are used or not.
Minimal graphql.schema and models to reproduce
versions
-
v0.17.34 -
1.20
I'm also interested to see if this is possible.
did you find any answer
I remember that this was default earlier but seems like it is not anymore. Found an easier solution for that. Instead of adding each field to the gqlgen.yml you can declare the directive directive @goField(forceResolver: Boolean) on FIELD_DEFINITION in the schema and use it at each field you would like to have an explizit resolver.
directive @goField(forceResolver: Boolean) on FIELD_DEFINITION
type User {
id: ID!
mother: User! @goField(forceResolver: true)
}
I've also been grasping for this feature
My first experience of a GraphQL server was one written in NodeJS (apollo-server and AWS AppSync), without configuration these frameworks allow you to define resolvers for fields of Types
I am finding it very difficult to develop using gqlgen. As I understand it I need to add config for every field on every type in all my schema files, in order to get a developer experience comparable to apollo server or similar NodeJS GQL framework.