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

Missing resolvers in supergraph schema, potential issue with Query/Mutation type merging

Open faris-dizdarevic-transflo opened this issue 1 year ago β€’ 3 comments

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • [x] 1. The issue provides a reproduction available on CodeSandbox

Make sure to fork this template and follow the README instructions.

  • [x] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

Describe the bug

The majority of resolvers are missing from the Mesh-generated supergraph.graphql schema and subsequently the GQL explorer when running my Hive Gateway on top of a single GQL subgraph running Yoga with a GraphQL Codegen server preset.

To Reproduce Steps to reproduce the behavior:

In the CodeSandbox above, I recommend following the README to first set up and run the subgraph. View the schema/explorer and note the available resolvers. Then, run the gateway and note the missing resolvers.

Expected behavior

I would expect to see all Query and Mutation resolvers from the different parts of my subgraph merged together in the final supergraph.

Environment:

See CodeSandbox package.json.

Additional context

Did some debugging of the compose CLI and I noted that the introspection query DOES manage to retrieve the full schema which contains multiple extend type Query and extend type Mutation definitions of which only the very last one (of each) gets pulled into the supergraph. I didn't debug any further into the graphql libs.

I think the scripts and configuration for Codegen are missing. Could you add some instructions to the CodeSandbox to reproduce the issue step by step, and make sure it shows the issue as expected? Thanks πŸ™

ardatan avatar Dec 24 '24 09:12 ardatan

I think the scripts and configuration for Codegen are missing. Could you add some instructions to the CodeSandbox to reproduce the issue step by step, and make sure it shows the issue as expected? Thanks πŸ™

First time using CodeSandbox haha sorry about that - I've updated the link to the sandbox so it should be accessible now. Please ignore the "install dependencies" terminal that opens and just reference the "start" terminal which should automatically boot both the subgraph & gateway and expose them under preview URLs. (local ports are :8080 and :8081, respectively). The README has instructions on the expected issue and how it can be viewed.

The codegen is with the subgraph under example_subgraph, while the Mesh and Hive gateway config is under gateway.

Appreciate the help!

@ardatan any chance I can get some sort of update here? Tried the same scenario again and exact same issue.

My subgraph has ~5 separate schema.graphql files that are composed together via a server preset (https://the-guild.dev/graphql/codegen/docs/guides/graphql-server-apollo-yoga-with-server-preset) to one unified subgraph. Frontend clients that codegen off of my subgraph get all the expected Query and Mutation types - but using the mesh-compose CLI on the same subgraph does not, and the resulting supergraph only shows 1 set of Query/Mutation (from one of the schema.graphql files).