Open AndrewIngram opened 6 months ago
Unfortunately this isn't easy to do from a technical perspective. Plugins don't have an easy way to affect resolver types without creating custom methods.
The scope-auth plugin can change contexts but it does it through one of 2 methods:
Using a t.withAuth({ ...scopes }).field
or t.authField
to define fields with changed contexts. We could potentially copy that pattern, but just doing it automatically on normal field definitions isn't possible
We're trying out the subgraph plugin, as we have two schemas. They actually have different context shapes (not drastically so, but enough that we've given them different TypeScript types), at the moment I'm supporting this by having the Pothos context type being a union of the two, but this leaves me having to manually write discriminator code in resolvers to determine which is applicable. It'd be useful if we could define the context type per subgraph, such that the context arg is as narrow as possible.