Open xuorig opened 8 months ago
this is something we have been thinking about for some time, cf https://github.com/apollographql/router/issues/3363. There's some room for one more service between the raw request/response bytes and the graphql structures
I endorse this request as we have been contemplating on modifying the request before it reaches the supergraph service but after the query has been resolved from APQ and PQL. Would love to discuss more if needed.
@Geal - I also see this #4602 which allows access to it but it would be great if we can allow the plugin owners to generate parsed document post the modified query and re-attach it to the context.
Currently, APQ, PQ, and Query Analysis happens inside the RouterService. Those different layers are able to either:
While this works well, it does mean it is hard for plugin owners to transform a supergraph::Request before it gets to those layers. This could be useful for various query transformations, implementing custom PQ-ish protocols, etc. The alternative is to either fully take control of the router service (unwise), or make these transforms to the router::Request itself, which requires parsing the body / constructing expensive structures.
An additional plugin hook, a "transform service" of some kind would be great.