The graphql-tools documentation mentions that:
You don’t need to specify resolvers for every type in your schema. If you don’t specify a resolver, GraphQL.js falls back to a default one, which does the following:
- Returns a property from obj with the relevant field name, or
- Calls a function on obj with the relevant field name and passes the query arguments into that function
My question is: how can I specify that function to change the default behavior?
For example, maybe instead of just returning object.title when the client asks for the title field, I would like to return object.title.en, or object.title.fr, etc. depending on the current language.
It would be nice to be able to specify this as the default behavior without having to spell out resolver functions for every single field?