Skip to content

Commit 89ae53f

Browse files
Merge pull request #1996 from mohatt/ref-resolver-context-fix
fix(graphql): Fix federation reference resolver context args
2 parents 6eac08e + fb0846a commit 89ae53f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/graphql/lib/factories/params.factory.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ export class GqlParamsFactory implements ParamsFactory {
77
if (!args) {
88
return null;
99
}
10+
// Reference resolver args don't have root argument
11+
if (args.length === 3) {
12+
args = [undefined, ...args];
13+
}
1014
switch (type as GqlParamtype) {
1115
case GqlParamtype.ROOT:
1216
return args[0];

packages/graphql/lib/services/gql-execution-context.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ export class GqlExecutionContext
1111
{
1212
static create(context: ExecutionContext): GqlExecutionContext {
1313
const type = context.getType();
14+
const args = context.getArgs();
1415
const gqlContext = new GqlExecutionContext(
15-
context.getArgs(),
16+
// Reference resolver args don't have root argument
17+
args.length === 3 ? [undefined, ...args] : args,
1618
context.getClass(),
1719
context.getHandler(),
1820
);

0 commit comments

Comments
 (0)