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

Merge configs created using stitching directives don't respect type rename transforms on the subschema

Open wlee-guild opened this issue 3 years ago • 0 comments

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.

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.

wlee-guild avatar Mar 08 '22 21:03 wlee-guild