Currently graphqlgen does not make it possible to use a DelegatedParentResolver. I think we should remove this blocker. We can start with basic support which should be almost trivial. A completely type-safe approach, while nice, would be much more complicated.
What is a DelegatedParentResolver
The resolver signature that most apollo developers are most familiar with:
I have not found a good name for this kind of resolver. Since it supports resolving fields that depend on the result of a delegated parent field hence I've referred to them as a DelegatedParentResolver here.
One thing to think about is the impact on IDE type documentation, e.g.:
However, I think even the current resolver type doesn't render very well in e.g. VSCode anyway, and that problem [quality of type doc hints/rendering] is something for vscode etc. to shoulder obviously.
Users will have to, and probably already do, rely on the either interacting over inner parts of their resolver, reacting to type errors, and "peeking"/code-jumping into definitions.
Parameters
(actually that type rendering is arguably unhelpful in its own right)
Return
Return type is a bit trickier but can be had by hovering over the arrow:
Currently graphqlgen does not make it possible to use a
DelegatedParentResolver
. I think we should remove this blocker. We can start with basic support which should be almost trivial. A completely type-safe approach, while nice, would be much more complicated.What is a
DelegatedParentResolver
The resolver signature that most apollo developers are most familiar with:
However there is another resolver signature:
It wasn't as easy as I would hope to find good documentation about this. Some references:
I have not found a good name for this kind of resolver. Since it supports resolving fields that depend on the result of a delegated parent field hence I've referred to them as a
DelegatedParentResolver
here.Proposed Types
An example of a current graphqlgen resolver type:
snapshot link
A generic take on what the new resolver type could be:
One thing to think about is the impact on IDE type documentation, e.g.:
However, I think even the current resolver type doesn't render very well in e.g. VSCode anyway, and that problem [quality of type doc hints/rendering] is something for vscode etc. to shoulder obviously.
Users will have to, and probably already do, rely on the either interacting over inner parts of their resolver, reacting to type errors, and "peeking"/code-jumping into definitions.
Parameters
(actually that type rendering is arguably unhelpful in its own right)
Return
Return type is a bit trickier but can be had by hovering over the arrow:
Example New TS