You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking into integrating the automatic caching of Apollo which I use as a server into my schema and there are two approaches. Either declaring a directive or setting it dynamically. Unfortunately there are two issues:
The directive that I tried to add via the directive plugin is not appearing in the schema at all. Thus it has no effect when declaring it for certain fields. I guess I need a transformer but there is none that exists for that as far as I can tell.
Setting the cacheControl dynamically works, but is not part of the info object according to TypeScript.
Do you have suggestions on how to support this within Pothos? Either option would be nice, the former slightly more as it clearly documents the behavior for consumers within the schema.
The text was updated successfully, but these errors were encountered:
This can either be added to a declaration file that ts automatically imports, or add or import this from the file that defines the builder to ensure that the definition is always imported.
For the directives plugin, to get the directives in the schema, you need to use something like graphQL tools to print the schema with directives. Unfortunately the printSchema method from graphql does not have a way to print directives
Yeah I was also considering to go for module augmentation as this is one of the very rare occasions where it's actually less detrimental and unexpected. I'll just use that for now even though the DX of explicitly calling it over adding a directive is less convenient. Will research at some point how to print the directives as you proposed.
I was looking into integrating the automatic caching of Apollo which I use as a server into my schema and there are two approaches. Either declaring a directive or setting it dynamically. Unfortunately there are two issues:
cacheControl
dynamically works, but is not part of theinfo
object according to TypeScript.Do you have suggestions on how to support this within Pothos? Either option would be nice, the former slightly more as it clearly documents the behavior for consumers within the schema.
The text was updated successfully, but these errors were encountered: