Define Transformer for GraphQL API Resource

  • Goal: I want to be able to define a transformer which can be automatically used on a resource (eg. a GraphQL API resource) to transform the response data, without having to define it for every use of the resource across different applications.

  • Steps: It doesn't seem to be possible to define a transformer when you define a Resource, only when you use the Resource in a given application (which means I would need to define it >35 times for my use case). Maybe I've missed something? I also looked into Workflows but they don't work with Authenticated API calls as far as I can tell so that wouldn't work for our use-case either.

  • Details: We have a resource which allows us to call our Internal GraphQL API from our Retool applications. The data comes back in a specific format, and it'd be very helpful to be able to transform the data automatically for every use-case rather than at specific usage sites of this resource.

1 Like

Hi @emilyruby and welcome to the forum!

I know the feeling as I've worked with a client that has multiple apps connecting to shopify via Graphql and we need to add transformers to each query.

Something that comes to mind is that you could set up a global function and then in your transformer simply pass data as a parameter. You would still have to call the function in each query, but i guess it is better than copying the transformer every time. And if you have a need to update the transformer, you can do it only once in the function.

2 Likes

Here's more info on the current status of the Functions beta.

Preloaded app-level Javascript is a similar functionality that is available on all plans (much of which will be replaced by Functions long term).