ardatan / ardatan/graphql-tools
Merge configs created using stitching directives don't respect type rename transforms on the subschema
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 830
- Avg merge
- 10h 59m
- Merged PRs (30d)
- 45
Description
**Describe the bug**
When using the stitching directives transformer with a transform that changes the type name the merge configs are created under the old type name rather than the transformed type name. This causes the stitched schema to be unable to resolve data for the renamed types.
**To Reproduce**
Steps to reproduce the behavior:
I've created a simple reproduction of the issue using the `RenameTypes` class from the `wrap` package in a public repository located [here](https://github.com/wlee-guild/stitch-directives-with-rename).
**Expected behavior**
I would expect that the merge configs are applied to the transformed type names as the original types won't be present in the wrapped subschema is being delegated to.
**Environment:**
- OS: MacOS Big Sur 11.6.3
- @graphql-tools/schema: 8.3.2,
- @graphql-tools/stitch: 8.4.4,
- @graphql-tools/stitching-directives: 2.2.2,
- @graphql-tools/wrap: 8.4.3,
- NodeJS: 16.11.1
**Additional context**
We are able to work around this and get data resolving again by creating a secondary subschema config transformer that moves the merge configs to the new type name. Additionally, manually specifying a merge config for the renamed type as you would for a schema extension also causes the stitched schema to resolve properly, but this doesn't scale well if you have a large number of renamed types.
Contributor guide
Research direction
Start with the public reproduction repository and trace how the stitching directives transformer creates merge configs alongside the RenameTypes transform from the wrap package. Compare the original and transformed type names; done means merge configs target the transformed names and the stitched schema resolves data for renamed types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100