lighthouse
lighthouse copied to clipboard
Support custom edge pivot data with `@rename` directive
A while back I introduced #871 which gave the ability to provide a custom edge for the @belongsToMany directive. This, in turn, made it possible include pivot custom data within the edge.
I'm realizing now that the @rename directive wasn't taken into account for handling the custom edge data. This should be a very simple fix which I'm happy to tackle. I just wanted to make an issue so I don't forget. 😆
@spawnia I'm working on the PR for this and could use some direction.
I'm taking a look at where the pivot data is being resolved: https://github.com/nuwave/lighthouse/blob/master/src/Pagination/ConnectionField.php#L73
It seems atypical to how fields are normally resolved, which I think is why the @rename directive is being skipped. I can see the directive in the field resolver, but I'm not sure how to either trigger the resolver to fire, or grab the directive for the given field and grab the rename attribute. I feel like there are a couple ways to approach this and I'm not sure which to road to take.
I actually think that @rename is still being executed, but i see how it might not have the desired effect.
Can you share an example or a failing test case of what you would like to happen?