graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

[Feature] Root-level transforms (for custom directives)

Open arnaud opened this issue 7 months ago • 2 comments

Is your feature request related to a problem? Please describe.

We intend to write our own custom directives, that match our specific business needs.

Describe the solution you'd like

In order to implement global and generic directives, let's say like @filter, we would like to rely on the previously-available feature of defining root-level transforms. It seems that since v1, this feature is no more.

Describe alternatives you've considered

I'm leaning towards implementing a custom envelope plugin. But it would need to address two specific elements:

  • Defining the directive globally in the GraphQL schema;
  • Running its corresponding implementation;

arnaud avatar May 20 '25 12:05 arnaud

You can apply root level transforms on your own with the plugin system on the gateway, because we saw that root-levelt ransforms are not part of composition. You can always manipulate the execution in the gateway, wrap the schema with some transforms and so on. Not sure how extra directives help in this case but it is up to you, I don't think personally composition should have root level transforms but those can be part of the gateway instead.

ardatan avatar May 20 '25 12:05 ardatan

This helps, thanks @ardatan. I'll try the envelope way, then hopefully if all go smooth, will share back to the community how to tackle this.

arnaud avatar May 20 '25 15:05 arnaud