graphql-query-rewriter / core

Seamlessly turn breaking GraphQL changes into non-breaking changes
https://graphql-query-rewriter.github.io/core
MIT License
407 stars 15 forks source link

feat(rewriter): expose parent object and element path to rewriter #20

Closed gregbty closed 3 years ago

gregbty commented 3 years ago

This changes the implementation of rewriteResultsAtPath so that now the parent and path of the element is exposed to Rewriter.rewriteResponse instead of the element itself. This should allow #14 to modify the response.

chanind commented 3 years ago

:tada: This PR is included in version 2.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

gregbty commented 3 years ago

Looks like I missed one thing. This doesn't change the behavior of the output of the rewrites. While we can now see the parent object and modify it, those changes are ignored because the caller only maps the result to the specified path/key. Fixing that is a much bigger change because it would fundamentally change how rewrites are done. For now though, I can at least use this to rename paths by looking via a parent rewrite.