Open sixmen opened 3 weeks ago
Progress of the issue based on the Contributor Workflow
Make sure to fork this template and run yarn generate in the terminal. Please make sure the GraphQL Tools package versions under package.json matches yours.
Make sure to fork this template and run yarn generate in the terminal.
yarn generate
Please make sure the GraphQL Tools package versions under package.json matches yours.
package.json
Describe the bug
When I use stitch & delegate, some fields described in selectionSet does not pass to the source schema.
To Reproduce Steps to reproduce the behavior:
https://codesandbox.io/p/devbox/t2xglt
import { buildSchema, graphql } from 'graphql'; import { addResolversToSchema } from '@graphql-tools/schema'; import { stitchSchemas } from '@graphql-tools/stitch'; import { delegateToSchema } from '@graphql-tools/delegate'; const sub_schema = addResolversToSchema({ schema: buildSchema(` type Query { current_user: User } type User { id: ID! name: String! age: Int! } `), resolvers: { Query: { current_user: () => ({ id: '5', name: 'John Doe', age: 10 }), }, }, }); const stitched_schema = stitchSchemas({ subschemas: [ { schema: sub_schema, createProxyingResolver: (options) => { return (_parent, _args, context, info) => { const operationName = info.operation.name ? info.operation.name.value : undefined; return delegateToSchema({ schema: options.subschemaConfig, operation: options.operation, context, info, operationName, }); }; }, }, ], resolvers: { User: { name: { selectionSet: '{ age }', resolve: (parent) => `${parent.name}(${parent.age})`, }, }, }, }); console.log((await graphql({ schema: stitched_schema, source: '{ current_user { name } }' })).data.current_user.name);
Expected behavior
John Doe(10)
John Doe(undefined)
Environment:
Additional context
It works well with @graphql-tools/delegate: 10.0.9
@graphql-tools/delegate: 10.0.9
I think https://github.com/ardatan/graphql-tools/pull/6134 makes this problem. If I change if (!skipAddingDependencyNodes) to if (true) (ignore changes of the PR), I can get the correct answer.
if (!skipAddingDependencyNodes)
if (true)
If I add an another field instead of overriding existing fields (ie. name -> name_age), it works well.
Issue workflow progress
Progress of the issue based on the Contributor Workflow
Describe the bug
When I use stitch & delegate, some fields described in selectionSet does not pass to the source schema.
To Reproduce Steps to reproduce the behavior:
https://codesandbox.io/p/devbox/t2xglt
Expected behavior
John Doe(10)
John Doe(undefined)
Environment:
Additional context
It works well with
@graphql-tools/delegate: 10.0.9
I think https://github.com/ardatan/graphql-tools/pull/6134 makes this problem. If I change
if (!skipAddingDependencyNodes)
toif (true)
(ignore changes of the PR), I can get the correct answer.If I add an another field instead of overriding existing fields (ie. name -> name_age), it works well.